From 1753337cf5d0aa5ba04b29ded65b824d9cf12c00 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 22 Nov 2009 05:20:41 +0000 Subject: Improve psql's tabular display of wrapped-around data by inserting markers in the formerly-always-blank columns just to left and right of the data. Different marking is used for a line break caused by a newline in the data than for a straight wraparound. A newline break is signaled by a "+" in the right margin column in ASCII mode, or a carriage return arrow in UNICODE mode. Wraparound is signaled by a dot in the right margin as well as the following left margin in ASCII mode, or an ellipsis symbol in the same places in UNICODE mode. "\pset linestyle old-ascii" is added to make the previous behavior available if anyone really wants it. In passing, this commit also cleans up a few regression test files that had unintended spacing differences from the current actual output. Roger Leigh, reviewed by Gabrielle Roth and other members of PDXPUG. --- src/bin/psql/print.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/bin/psql/print.h') diff --git a/src/bin/psql/print.h b/src/bin/psql/print.h index b09aac90f77..30df35d115a 100644 --- a/src/bin/psql/print.h +++ b/src/bin/psql/print.h @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/print.h,v 1.41 2009/10/13 21:04:01 tgl Exp $ + * $PostgreSQL: pgsql/src/bin/psql/print.h,v 1.42 2009/11/22 05:20:41 tgl Exp $ */ #ifndef PRINT_H #define PRINT_H @@ -41,14 +41,30 @@ typedef enum printTextRule PRINT_RULE_DATA /* data line (hrule is unused here) */ } printTextRule; +typedef enum printTextLineWrap +{ + /* Line wrapping conditions */ + PRINT_LINE_WRAP_NONE, /* No wrapping */ + PRINT_LINE_WRAP_WRAP, /* Wraparound due to overlength line */ + PRINT_LINE_WRAP_NEWLINE /* Newline in data */ +} printTextLineWrap; + typedef struct printTextFormat { /* A complete line style */ const char *name; /* for display purposes */ printTextLineFormat lrule[4]; /* indexed by enum printTextRule */ - const char *midvrule_cont; /* vertical line for continue after newline */ + const char *midvrule_nl; /* vertical line for continue after newline */ const char *midvrule_wrap; /* vertical line for wrapped data */ const char *midvrule_blank; /* vertical line for blank data */ + const char *header_nl_left; /* left mark after newline */ + const char *header_nl_right; /* right mark for newline */ + const char *nl_left; /* left mark after newline */ + const char *nl_right; /* right mark for newline */ + const char *wrap_left; /* left mark after wrapped data */ + const char *wrap_right; /* right mark for wrapped data */ + bool wrap_right_border; /* use right-hand border for wrap marks + * when border=0? */ } printTextFormat; typedef struct printTableOpt @@ -125,6 +141,7 @@ typedef struct printQueryOpt extern const printTextFormat pg_asciiformat; +extern const printTextFormat pg_asciiformat_old; extern const printTextFormat pg_utf8format; -- cgit v1.2.3