Skip to content

Commit a69b0b2

Browse files
committed
Code + docs review for unicode linestyle patch.
Fix some brain fade in commit a2dabf0: erroneous variable names in docs, rearrangements that made sentences less clear not more so, undocumented and poorly-chosen-anyway API behaviors of subroutines, bad grammar in error messages, copy-and-paste faults. Albe Laurenz and Tom Lane
1 parent 4efe26c commit a69b0b2

File tree

3 files changed

+45
-39
lines changed

3 files changed

+45
-39
lines changed

doc/src/sgml/ref/psql-ref.sgml

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2038,14 +2038,15 @@ lo_import 152801
20382038
The <replaceable class="parameter">value</replaceable> must be a
20392039
number. In general, the higher
20402040
the number the more borders and lines the tables will have,
2041-
but this depends on the particular format. In
2042-
<acronym>HTML</acronym> format, this will translate directly
2043-
into the <literal>border=...</literal> attribute; in
2044-
<literal>latex</literal> and <literal>latex-longtable</literal>
2045-
formats, a value of 3 will add a dividing line between each row; in
2046-
the other formats only values 0 (no border), 1 (internal dividing
2047-
lines), and 2 (table frame) make sense and values above 2 will be
2048-
treated the same as <literal>border = 2</literal>.
2041+
but details depend on the particular format.
2042+
In <acronym>HTML</acronym> format, this will translate directly
2043+
into the <literal>border=...</literal> attribute.
2044+
In most other formats only values 0 (no border), 1 (internal
2045+
dividing lines), and 2 (table frame) make sense, and values above 2
2046+
will be treated the same as <literal>border = 2</literal>.
2047+
The <literal>latex</literal> and <literal>latex-longtable</literal>
2048+
formats additionally allow a value of 3 to add dividing lines
2049+
between data rows.
20492050
</para>
20502051
</listitem>
20512052
</varlistentry>
@@ -2220,8 +2221,8 @@ lo_import 152801
22202221

22212222
<para>
22222223
When the <literal>border</> setting is greater than zero,
2223-
this option also determines the characters
2224-
with which the border lines are drawn.
2224+
the <literal>linestyle</literal> option also determines the
2225+
characters with which the border lines are drawn.
22252226
Plain <acronym>ASCII</acronym> characters work everywhere, but
22262227
Unicode characters look nicer on displays that recognize them.
22272228
</para>
@@ -2364,31 +2365,34 @@ lo_import 152801
23642365
</varlistentry>
23652366

23662367
<varlistentry>
2367-
<term><literal>unicode_border_style</literal></term>
2368+
<term><literal>unicode_border_linestyle</literal></term>
23682369
<listitem>
23692370
<para>
2370-
Sets the border drawing style for the <literal>unicode</literal> line style to one
2371-
of <literal>single</literal> or <literal>double</literal>.
2371+
Sets the border drawing style for the <literal>unicode</literal>
2372+
line style to one of <literal>single</literal>
2373+
or <literal>double</literal>.
23722374
</para>
23732375
</listitem>
23742376
</varlistentry>
23752377

23762378
<varlistentry>
2377-
<term><literal>unicode_column_style</literal></term>
2379+
<term><literal>unicode_column_linestyle</literal></term>
23782380
<listitem>
23792381
<para>
2380-
Sets the column drawing style for the <literal>unicode</literal> line style to one
2381-
of <literal>single</literal> or <literal>double</literal>.
2382+
Sets the column drawing style for the <literal>unicode</literal>
2383+
line style to one of <literal>single</literal>
2384+
or <literal>double</literal>.
23822385
</para>
23832386
</listitem>
23842387
</varlistentry>
23852388

23862389
<varlistentry>
2387-
<term><literal>unicode_header_style</literal></term>
2390+
<term><literal>unicode_header_linestyle</literal></term>
23882391
<listitem>
23892392
<para>
2390-
Sets the header drawing style for the <literal>unicode</literal> line style to one
2391-
of <literal>single</literal> or <literal>double</literal>.
2393+
Sets the header drawing style for the <literal>unicode</literal>
2394+
line style to one of <literal>single</literal>
2395+
or <literal>double</literal>.
23922396
</para>
23932397
</listitem>
23942398
</varlistentry>

doc/src/sgml/release-9.5.sgml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2061,12 +2061,12 @@ FIXME: Add more specifics?
20612061
2014-09-12 [a2dabf0] Stephe..: Add unicode_{column|header|border}_style to psql
20622062
-->
20632063
<para>
2064-
Allow column, header, and border control to <application>psql</>'s
2065-
Unicode style (Pavel Stehule)
2064+
Provide separate column, header, and border linestyle control
2065+
in <application>psql</>'s unicode linestyle (Pavel Stehule)
20662066
</para>
20672067

20682068
<para>
2069-
Single or double output is supported; the default is
2069+
Single or double lines are supported; the default is
20702070
<literal>single</>.
20712071
</para>
20722072
</listitem>

src/bin/psql/command.c

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2415,11 +2415,11 @@ _align2string(enum printFormat in)
24152415
}
24162416

24172417
/*
2418-
* Parse entered unicode linestyle. Returns true, when entered string is
2419-
* known linestyle: single, double else returns false.
2418+
* Parse entered unicode linestyle. If ok, update *linestyle and return
2419+
* true, else return false.
24202420
*/
24212421
static bool
2422-
set_unicode_line_style(printQueryOpt *popt, const char *value, size_t vallen,
2422+
set_unicode_line_style(const char *value, size_t vallen,
24232423
unicode_linestyle *linestyle)
24242424
{
24252425
if (pg_strncasecmp("single", value, vallen) == 0)
@@ -2428,10 +2428,6 @@ set_unicode_line_style(printQueryOpt *popt, const char *value, size_t vallen,
24282428
*linestyle = UNICODE_LINESTYLE_DOUBLE;
24292429
else
24302430
return false;
2431-
2432-
/* input is ok, generate new unicode style */
2433-
refresh_utf8format(&(popt->topt));
2434-
24352431
return true;
24362432
}
24372433

@@ -2517,10 +2513,12 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
25172513
{
25182514
if (!value)
25192515
;
2520-
else if (!set_unicode_line_style(popt, value, vallen,
2521-
&popt->topt.unicode_border_linestyle))
2516+
else if (set_unicode_line_style(value, vallen,
2517+
&popt->topt.unicode_border_linestyle))
2518+
refresh_utf8format(&(popt->topt));
2519+
else
25222520
{
2523-
psql_error("\\pset: allowed unicode border linestyle are single, double\n");
2521+
psql_error("\\pset: allowed unicode border linestyles are single, double\n");
25242522
return false;
25252523
}
25262524
}
@@ -2530,10 +2528,12 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
25302528
{
25312529
if (!value)
25322530
;
2533-
else if (!set_unicode_line_style(popt, value, vallen,
2534-
&popt->topt.unicode_column_linestyle))
2531+
else if (set_unicode_line_style(value, vallen,
2532+
&popt->topt.unicode_column_linestyle))
2533+
refresh_utf8format(&(popt->topt));
2534+
else
25352535
{
2536-
psql_error("\\pset: allowed unicode column linestyle are single, double\n");
2536+
psql_error("\\pset: allowed unicode column linestyles are single, double\n");
25372537
return false;
25382538
}
25392539
}
@@ -2543,10 +2543,12 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
25432543
{
25442544
if (!value)
25452545
;
2546-
else if (!set_unicode_line_style(popt, value, vallen,
2547-
&popt->topt.unicode_header_linestyle))
2546+
else if (set_unicode_line_style(value, vallen,
2547+
&popt->topt.unicode_header_linestyle))
2548+
refresh_utf8format(&(popt->topt));
2549+
else
25482550
{
2549-
psql_error("\\pset: allowed unicode header linestyle are single, double\n");
2551+
psql_error("\\pset: allowed unicode header linestyles are single, double\n");
25502552
return false;
25512553
}
25522554
}
@@ -2871,7 +2873,7 @@ printPsetInfo(const char *param, struct printQueryOpt *popt)
28712873

28722874
else if (strcmp(param, "unicode_header_linestyle") == 0)
28732875
{
2874-
printf(_("Unicode border linestyle is \"%s\".\n"),
2876+
printf(_("Unicode header linestyle is \"%s\".\n"),
28752877
_unicode_linestyle2string(popt->topt.unicode_header_linestyle));
28762878
}
28772879

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy