2013/11/26 Pavel Stehule <pavel.steh...@gmail.com> > > > > 2013/11/26 Peter Eisentraut <pete...@gmx.net> > >> On 11/22/13, 3:26 AM, Pavel Stehule wrote: >> > website is related to patch for 9.3 (I add note there) >> > >> > patch for 9.4 is fixed - and now with small doc >> >> I think it would help if we considered the new border styles and the new >> line styles separately. >> >> I don't find the new border styles to be particularly useful. They just >> use up vertical screen space, which is usually more precious than >> vertical space. Is there a situation where you would find these styles >> to be more useful than the existing ones? Keep in mind that pset is >> usually set permanently, so it wouldn't be practical to use a different >> border style depending on how the query results shape up (like \x auto). >> >> Now for the linestyles. I can see how some of them are attractive, but >> several of them have poor aesthetics, I think. I don't see a reason to >> accept 7 new styles just for fun. If I had to choose, I'd consider >> -double1 and -double4 to be acceptable. >> > I am sending reduced patch
I add a double1, double4 and double5 - renamed to double1,double2, double3 support for border 3 and 4 removed postgres=# \pset linestyle double1 \pset border 2 \l Line style (linestyle) is double1. Border style (border) is 2. List of databases ┌───────────┬──────────┬──────────┬─────────────┬─────────────┬───────────────────────┐ │ Name │ Owner │ Encoding │ Collate │ Ctype │ Access privileges │ ╞═══════════╪══════════╪══════════╪═════════════╪═════════════╪═══════════════════════╡ │ postgres │ postgres │ UTF8 │ en_US.UTF-8 │ en_US.UTF-8 │ │ │ template0 │ postgres │ UTF8 │ en_US.UTF-8 │ en_US.UTF-8 │ =c/postgres │ │ │ │ │ │ │ postgres=CTc/postgres │ │ template1 │ postgres │ UTF8 │ en_US.UTF-8 │ en_US.UTF-8 │ =c/postgres │ │ │ │ │ │ │ postgres=CTc/postgres │ └───────────┴──────────┴──────────┴─────────────┴─────────────┴───────────────────────┘ (3 rows) postgres=# \pset linestyle double2 \pset border 2 \l Line style (linestyle) is double2. Border style (border) is 2. List of databases ╔═══════════╤══════════╤══════════╤═════════════╤═════════════╤═══════════════════════╗ ║ Name │ Owner │ Encoding │ Collate │ Ctype │ Access privileges ║ ╟───────────┼──────────┼──────────┼─────────────┼─────────────┼───────────────────────╢ ║ postgres │ postgres │ UTF8 │ en_US.UTF-8 │ en_US.UTF-8 │ ║ ║ template0 │ postgres │ UTF8 │ en_US.UTF-8 │ en_US.UTF-8 │ =c/postgres ║ ║ │ │ │ │ │ postgres=CTc/postgres ║ ║ template1 │ postgres │ UTF8 │ en_US.UTF-8 │ en_US.UTF-8 │ =c/postgres ║ ║ │ │ │ │ │ postgres=CTc/postgres ║ ╚═══════════╧══════════╧══════════╧═════════════╧═════════════╧═══════════════════════╝ (3 rows) postgres=# \pset linestyle double3 \pset border 2 \l Line style (linestyle) is double3. Border style (border) is 2. List of databases ╔═══════════╦══════════╦══════════╦═════════════╦═════════════╦═══════════════════════╗ ║ Name ║ Owner ║ Encoding ║ Collate ║ Ctype ║ Access privileges ║ ╠═══════════╬══════════╬══════════╬═════════════╬═════════════╬═══════════════════════╣ ║ postgres ║ postgres ║ UTF8 ║ en_US.UTF-8 ║ en_US.UTF-8 ║ ║ ║ template0 ║ postgres ║ UTF8 ║ en_US.UTF-8 ║ en_US.UTF-8 ║ =c/postgres ║ ║ ║ ║ ║ ║ ║ postgres=CTc/postgres ║ ║ template1 ║ postgres ║ UTF8 ║ en_US.UTF-8 ║ en_US.UTF-8 ║ =c/postgres ║ ║ ║ ║ ║ ║ ║ postgres=CTc/postgres ║ ╚═══════════╩══════════╩══════════╩═════════════╩═════════════╩═══════════════════════╝ (3 rows) Pavel > >
commit 47b3258db6e3e82399417f57ad551ad740348635 Author: Pavel Stehule <pavel.steh...@gooddata.com> Date: Wed Nov 27 15:09:01 2013 +0100 initial diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml index 264cfe6..6e74690 100644 --- a/doc/src/sgml/ref/psql-ref.sgml +++ b/doc/src/sgml/ref/psql-ref.sgml @@ -2088,9 +2088,10 @@ lo_import 152801 <para> Sets the border line drawing style to one of <literal>ascii</literal>, <literal>old-ascii</literal> - or <literal>unicode</literal>. - Unique abbreviations are allowed. (That would mean one - letter is enough.) + or <literal>unicode</literal>, <literal>double1</literal>, + <literal>double2</literal> or <literal>double3</literal> + (unicode styles). Unique abbreviations are allowed. + (That would mean one letter is enough.) The default setting is <literal>ascii</>. This option only affects the <literal>aligned</> and <literal>wrapped</> output formats. diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index 638d8cb..91bb838 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -2285,9 +2285,16 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet) popt->topt.line_style = &pg_asciiformat_old; else if (pg_strncasecmp("unicode", value, vallen) == 0) popt->topt.line_style = &pg_utf8format; + else if (pg_strncasecmp("double1", value, vallen) == 0) + popt->topt.line_style = &pg_double1format; + else if (pg_strncasecmp("double2", value, vallen) == 0) + popt->topt.line_style = &pg_double2format; + else if (pg_strncasecmp("double3", value, vallen) == 0) + popt->topt.line_style = &pg_double3format; else { - psql_error("\\pset: allowed line styles are ascii, old-ascii, unicode\n"); + psql_error("\\pset: allowed line styles are ascii, old-ascii, unicode, " + "double1, double2, double3\n"); return false; } diff --git a/src/bin/psql/print.c b/src/bin/psql/print.c index 736225c..afe9f13 100644 --- a/src/bin/psql/print.c +++ b/src/bin/psql/print.c @@ -121,6 +121,83 @@ const printTextFormat pg_utf8format = true }; +const printTextFormat pg_double1format = { + "double1", + { + /* ─, ┌, ┬, ┐ */ + {"\342\224\200", "\342\224\214", "\342\224\254", "\342\224\220"}, + /* ═, ╞, ╪, ╡ */ + {"\342\225\220", "\342\225\236", "\342\225\252", "\342\225\241"}, + /* ─, └, ┴, ┘ */ + {"\342\224\200", "\342\224\224", "\342\224\264", "\342\224\230"}, + /* N/A, │, │, │ */ + {"", "\342\224\202", "\342\224\202", "\342\224\202"}, + }, + /* │ */ + "\342\224\202", + /* │ */ + "\342\224\202", + /* │ */ + "\342\224\202", + " ", + " ", + " ", + " ", + " ", + false +}; + +const printTextFormat pg_double2format = { + "double2", + { + /* ═, ╔, ╤, ╗ */ + {"\342\225\220", "\342\225\224", "\342\225\244", "\342\225\227"}, + /* ─, ╟, ┼, ╢ */ + {"\342\224\200", "\342\225\237", "\342\224\274", "\342\225\242"}, + /* ═, ╚, ╧, ╝ */ + {"\342\225\220", "\342\225\232", "\342\225\247", "\342\225\235"}, + /* N/A, ║, │, ║ */ + {"", "\342\225\221", "\342\224\202", "\342\225\221"}, + }, + /* │ */ + "\342\224\202", + /* │ */ + "\342\224\202", + /* │ */ + "\342\224\202", + " ", + " ", + " ", + " ", + " ", + false +}; + +const printTextFormat pg_double3format = { + "double3", + { + /* ═, ╔, ╦, ╗ */ + {"\342\225\220", "\342\225\224", "\342\225\246", "\342\225\227"}, + /* ═, ╠, ╬, ╣ */ + {"\342\225\220", "\342\225\240", "\342\225\254", "\342\225\243"}, + /* ═, ╚, ╩, ╝ */ + {"\342\225\220", "\342\225\232", "\342\225\251", "\342\225\235"}, + /* N/A, ║, ║, ║ */ + {"", "\342\225\221", "\342\225\221", "\342\225\221"}, + }, + /* ║ */ + "\342\225\221", + /* ║ */ + "\342\225\221", + /* ║ */ + "\342\225\221", + " ", + " ", + " ", + " ", + " ", + false +}; /* Local functions */ static int strlen_max_width(unsigned char *str, int *target_width, int encoding); diff --git a/src/bin/psql/print.h b/src/bin/psql/print.h index 9cfa3b6..d72e364 100644 --- a/src/bin/psql/print.h +++ b/src/bin/psql/print.h @@ -152,6 +152,9 @@ typedef struct printQueryOpt extern const printTextFormat pg_asciiformat; extern const printTextFormat pg_asciiformat_old; extern const printTextFormat pg_utf8format; +extern const printTextFormat pg_double1format; +extern const printTextFormat pg_double2format; +extern const printTextFormat pg_double3format; extern FILE *PageOutput(int lines, unsigned short int pager); diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index 2a0bb71..e4159c3 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -3355,7 +3355,8 @@ psql_completion(char *text, int start, int end) else if (strcmp(prev_wd, "linestyle") == 0) { static const char *const my_list[] = - {"ascii", "old-ascii", "unicode", NULL}; + {"ascii", "old-ascii", "unicode", + "double1", "double2", "double3", NULL}; COMPLETE_WITH_LIST_CS(my_list); }
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers