[pypy-commit] pypy py3.5: Allow readline text insertion without preparation.
exarkun
pypy.commits at gmail.com
Tue Aug 15 12:29:25 EDT 2017
Author: Jean-Paul Calderone <exarkun at twistedmatrix.com>
Branch: py3.5
Changeset: r92154:9f2963dca939
Date: 2017-08-15 12:28 -0400
http://bitbucket.org/pypy/pypy/changeset/9f2963dca939/
Log: Allow readline text insertion without preparation.
diff --git a/lib_pypy/pyrepl/reader.py b/lib_pypy/pyrepl/reader.py
--- a/lib_pypy/pyrepl/reader.py
+++ b/lib_pypy/pyrepl/reader.py
@@ -239,6 +239,10 @@
def __init__(self, console):
self.buffer = []
+ # Enable the use of `insert` without a `prepare` call - necessary to
+ # facilitate the tab completion hack implemented for
+ # <https://bugs.python.org/issue25660>.
+ self.pos = 0
self.ps1 = "->> "
self.ps2 = "/>> "
self.ps3 = "|.. "
diff --git a/pypy/module/readline/test/test_readline.py b/pypy/module/readline/test/test_readline.py
--- a/pypy/module/readline/test/test_readline.py
+++ b/pypy/module/readline/test/test_readline.py
@@ -29,3 +29,14 @@
readline.add_history("dummy")
assert readline.get_history_item(1) == "entrée 1"
assert readline.get_history_item(2) == "entrée 22"
+
+
+ def test_insert_text_leading_tab(self):
+ """
+ A literal tab can be inserted at the beginning of a line.
+
+ See <https://bugs.python.org/issue25660>
+ """
+ import readline
+ readline.insert_text("\t")
+ assert readline.get_line_buffer() == b"\t"
More information about the pypy-commit
mailing list