Author: Jean-Paul Calderone <[email protected]>
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&#233;e 1"
         assert readline.get_history_item(2) == "entr&#233;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"
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to