Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit48e0358

Browse files
committed
Avoid reading ~/.inputrc in tab-completion test, and revert other changes.
The true explanation for Peter Geoghegan's trouble report turns outto be that he has a ~/.inputrc that affects readline's behaviorenough to break this test. Prevent readline from reading that file.Also, the best way to prevent TERM from affecting the results seemsto be to unset it altogether, not to set it to "xterm". The latterchoice licenses readline to emit xterm escape sequences, and there'sa lot of variation in exactly what it will emit.Revert changes that attempted to account exactly for xterm escapesequences. We shouldn't need that with TERM unset, and it was notlooking like a maintainable solution anyway.Discussion:https://postgr.es/m/23181.1578167938@sss.pgh.pa.us
1 parent7e42478 commit48e0358

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

‎src/bin/psql/t/010_tab_completion.pl

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,17 @@
3838
my$historyfile ="${TestLib::log_path}/010_psql_history.txt";
3939
$ENV{PSQL_HISTORY} =$historyfile;
4040

41-
# Debug investigation
42-
note"TERM is set to '" . ($ENV{TERM} ||"<undef>") ."'";
43-
44-
# regexp to match one xterm escape sequence (CSI style only, for now)
45-
my$escseq ="(\e\\[[0-9;]*[A-Za-z])";
41+
# Another pitfall for developers is that they might have a ~/.inputrc
42+
# file that changes readline's behavior enough to affect this test.
43+
# So ignore any such file.
44+
$ENV{INPUTRC} ='/dev/null';
45+
46+
# Unset $TERM so that readline/libedit won't use any terminal-dependent
47+
# escape sequences; that leads to way too many cross-version variations
48+
# in the output.
49+
delete$ENV{TERM};
50+
# Some versions of readline inspect LS_COLORS, so for luck unset that too.
51+
delete$ENV{LS_COLORS};
4652

4753
# fire up an interactive psql session
4854
my$in ='';
@@ -107,12 +113,8 @@ sub clear_query
107113
"select\\* from my\a?tab",
108114
"complete my<tab> to mytab when there are multiple choices");
109115

110-
# some versions of readline/libedit require two tabs here, some only need one.
111-
# also, some might issue escape sequences to reposition the cursor, clear the
112-
# line, etc, instead of just printing some spaces.
113-
check_completion(
114-
"\t\t",
115-
"mytab$escseq*123( |$escseq)+mytab$escseq*246",
116+
# some versions of readline/libedit require two tabs here, some only need one
117+
check_completion("\t\t","mytab123 +mytab246",
116118
"offer multiple table choices");
117119

118120
check_completion("2\t","246",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp