aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/_pyrepl/simple_interact.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/_pyrepl/simple_interact.py')
-rw-r--r--Lib/_pyrepl/simple_interact.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/Lib/_pyrepl/simple_interact.py b/Lib/_pyrepl/simple_interact.py
index 3c79cf61d04..342a4b58bfd 100644
--- a/Lib/_pyrepl/simple_interact.py
+++ b/Lib/_pyrepl/simple_interact.py
@@ -28,6 +28,7 @@ from __future__ import annotations
import _sitebuiltins
import linecache
import functools
+import os
import sys
import code
@@ -50,7 +51,9 @@ def check() -> str:
try:
_get_reader()
except _error as e:
- return str(e) or repr(e) or "unknown error"
+ if term := os.environ.get("TERM", ""):
+ term = f"; TERM={term}"
+ return str(str(e) or repr(e) or "unknown error") + term
return ""
@@ -159,10 +162,8 @@ def run_multiline_interactive_console(
input_n += 1
except KeyboardInterrupt:
r = _get_reader()
- if r.last_command and 'isearch' in r.last_command.__name__:
- r.isearch_direction = ''
- r.console.forgetinput()
- r.pop_input_trans()
+ if r.input_trans is r.isearch_trans:
+ r.do_cmd(("isearch-end", [""]))
r.pos = len(r.get_unicode())
r.dirty = True
r.refresh()