Skip to content

Commit 3a95530

Browse files
authored
Merge branch 'master' into func-pr
2 parents 26bdc4e + 2fe94c3 commit 3a95530

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

‎AUTHORS‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ Contributors:
117117
* Eero Ruohola (ruohola)
118118
* Miroslav Šedivý (eumiro)
119119
* Eric R Young (ERYoung11)
120+
* Paweł Sacawa (psacawa)
120121

121122
Creator:
122123
--------

‎changelog.rst‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ Bug fixes:
1616
* Fix comments being lost in config when saving a named query. (#1240)
1717
* Fix IPython magic for ipython-sql >= 0.4.0
1818
* Fix pager not being used when output format is set to csv. (#1238)
19-
* Add function literals random, g;nerate_series, generate_subscripts
19+
* Add function literals random, generate_series, generate_subscripts
20+
* Fix ANSI escape codes in first line make the cli choose expanded output incorrectly
2021

2122
3.1.0
2223
=====

‎pgcli/main.py‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
from cli_helpers.tabular_output import TabularOutputFormatter
2828
from cli_helpers.tabular_output.preprocessors import align_decimals, format_numbers
29+
from cli_helpers.utils import strip_ansi
2930
import click
3031

3132
try:
@@ -1247,8 +1248,7 @@ def cli(
12471248
else:
12481249
print("Config file is now located at", config_full_path)
12491250
print(
1250-
"Please move the existing config file ~/.pgclirc to",
1251-
config_full_path,
1251+
"Please move the existing config file ~/.pgclirc to", config_full_path,
12521252
)
12531253
if list_dsn:
12541254
try:
@@ -1487,7 +1487,12 @@ def format_arrays(data, headers, **_):
14871487
formatted = iter(formatted.splitlines())
14881488
first_line = next(formatted)
14891489
formatted = itertools.chain([first_line], formatted)
1490-
if not expanded and max_width and len(first_line) > max_width and headers:
1490+
if (
1491+
not expanded
1492+
and max_width
1493+
and len(strip_ansi(first_line)) > max_width
1494+
and headers
1495+
):
14911496
formatted = formatter.format_output(
14921497
cur, headers, format_name="vertical", column_types=None, **output_kwargs
14931498
)

0 commit comments

Comments
 (0)