Skip to content

Commit b657a1f

Browse files
committed
add comment about \001 and \002
1 parent d71ca98 commit b657a1f

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

Lib/sqlite3/__main__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,15 @@ def main(*args):
133133
s = theme.syntax
134134

135135
if s.prompt:
136+
# Use RL_PROMPT_START_IGNORE (\001) and RL_PROMPT_END_IGNORE (\002) to
137+
# bracket non-printing characters. This tells readline to ignore them
138+
# when calculating screen space for redisplay during history scrolling.
139+
# See https://stackoverflow.com/a/9468954 for more details.
136140
sys.ps1 = f"\001{s.prompt}\002sqlite> \001{s.reset}\002"
137141
sys.ps2 = f"\001{s.prompt}\002 ... \001{s.reset}\002"
138142
else:
139-
sys.ps1 = f"sqlite> "
140-
sys.ps2 = f" ... "
143+
sys.ps1 = "sqlite> "
144+
sys.ps2 = " ... "
141145

142146
con = sqlite3.connect(args.filename, isolation_level=None)
143147
try:

0 commit comments

Comments
 (0)