commit 47b3258db6e3e82399417f57ad551ad740348635 Author: Pavel Stehule 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 Sets the border line drawing style to one of ascii, old-ascii - or unicode. - Unique abbreviations are allowed. (That would mean one - letter is enough.) + or unicode, double1, + double2 or double3 + (unicode styles). Unique abbreviations are allowed. + (That would mean one letter is enough.) The default setting is ascii. This option only affects the aligned and 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); }