Skip to content

Commit bebca3e

Browse files
committed
add comment about \001 and \002'
1 parent cf89e53 commit bebca3e

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

Lib/sqlite3/__main__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,12 @@ def main(*args):
132132
theme = get_theme()
133133
s = theme.syntax
134134

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

142142
con = sqlite3.connect(args.filename, isolation_level=None)
143143
try:

0 commit comments

Comments
 (0)