Shell: fixed an issue with the redirected input() method caused by the queued output change done back in June 2018.

Sun, 26 Aug 2018 15:03:20 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 26 Aug 2018 15:03:20 +0200
changeset 6478
f76f5bd81a90
parent 6477
096fefd24a26
child 6479
2ae32c9f9792

Shell: fixed an issue with the redirected input() method caused by the queued output change done back in June 2018.

Documentation/Help/source.qch file | annotate | diff | comparison | revisions
Documentation/Help/source.qhp file | annotate | diff | comparison | revisions
Documentation/Source/eric6.QScintilla.Shell.html file | annotate | diff | comparison | revisions
QScintilla/Shell.py file | annotate | diff | comparison | revisions
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Help/source.qhp	Thu Aug 23 18:21:58 2018 +0200
+++ b/Documentation/Help/source.qhp	Sun Aug 26 15:03:20 2018 +0200
@@ -14264,6 +14264,7 @@
       <keyword name="Shell.__write" id="Shell.__write" ref="eric6.QScintilla.Shell.html#Shell.__write" />
       <keyword name="Shell.__writeBanner" id="Shell.__writeBanner" ref="eric6.QScintilla.Shell.html#Shell.__writeBanner" />
       <keyword name="Shell.__writePrompt" id="Shell.__writePrompt" ref="eric6.QScintilla.Shell.html#Shell.__writePrompt" />
+      <keyword name="Shell.__writeQueued" id="Shell.__writeQueued" ref="eric6.QScintilla.Shell.html#Shell.__writeQueued" />
       <keyword name="Shell.__writeStdErr" id="Shell.__writeStdErr" ref="eric6.QScintilla.Shell.html#Shell.__writeStdErr" />
       <keyword name="Shell.__writeStdOut" id="Shell.__writeStdOut" ref="eric6.QScintilla.Shell.html#Shell.__writeStdOut" />
       <keyword name="Shell.clear" id="Shell.clear" ref="eric6.QScintilla.Shell.html#Shell.clear" />
--- a/Documentation/Source/eric6.QScintilla.Shell.html	Thu Aug 23 18:21:58 2018 +0200
+++ b/Documentation/Source/eric6.QScintilla.Shell.html	Sun Aug 26 15:03:20 2018 +0200
@@ -195,7 +195,7 @@
 <td>Private slot to handle the selection from the completion list.</td>
 </tr><tr>
 <td><a href="#Shell.__concatenateText">__concatenateText</a></td>
-<td>Private slot to get all available text and process it in one step.</td>
+<td>Private slot to queue text and process it in one step.</td>
 </tr><tr>
 <td><a href="#Shell.__configure">__configure</a></td>
 <td>Private method to open the configuration dialog.</td>
@@ -297,7 +297,7 @@
 <td>Private method to display a command from the history.</td>
 </tr><tr>
 <td><a href="#Shell.__write">__write</a></td>
-<td>Private method to display some text.</td>
+<td>Private method to display some text without queuing.</td>
 </tr><tr>
 <td><a href="#Shell.__writeBanner">__writeBanner</a></td>
 <td>Private method to write a banner with info from the debug client.</td>
@@ -305,6 +305,9 @@
 <td><a href="#Shell.__writePrompt">__writePrompt</a></td>
 <td>Private method to write the prompt.</td>
 </tr><tr>
+<td><a href="#Shell.__writeQueued">__writeQueued</a></td>
+<td>Private method to display some text using a write queue.</td>
+</tr><tr>
 <td><a href="#Shell.__writeStdErr">__writeStdErr</a></td>
 <td>Private method to display some text with StdErr label.</td>
 </tr><tr>
@@ -775,7 +778,7 @@
 <h4>Shell.__concatenateText</h4>
 <b>__concatenateText</b>(<i>text</i>)
 <p>
-        Private slot to get all available text and process it in one step.
+        Private slot to queue text and process it in one step.
 </p><dl>
 <dt><i>text</i> (str)</dt>
 <dd>
@@ -1097,11 +1100,11 @@
 <h4>Shell.__write</h4>
 <b>__write</b>(<i>s</i>)
 <p>
-        Private method to display some text.
+        Private method to display some text without queuing.
 </p><dl>
-<dt><i>s</i></dt>
+<dt><i>s</i> (str)</dt>
 <dd>
-text to be displayed (string)
+text to be displayed
 </dd>
 </dl><a NAME="Shell.__writeBanner" ID="Shell.__writeBanner"></a>
 <h4>Shell.__writeBanner</h4>
@@ -1124,7 +1127,17 @@
 <b>__writePrompt</b>(<i></i>)
 <p>
         Private method to write the prompt.
-</p><a NAME="Shell.__writeStdErr" ID="Shell.__writeStdErr"></a>
+</p><a NAME="Shell.__writeQueued" ID="Shell.__writeQueued"></a>
+<h4>Shell.__writeQueued</h4>
+<b>__writeQueued</b>(<i>s</i>)
+<p>
+        Private method to display some text using a write queue.
+</p><dl>
+<dt><i>s</i></dt>
+<dd>
+text to be displayed (string)
+</dd>
+</dl><a NAME="Shell.__writeStdErr" ID="Shell.__writeStdErr"></a>
 <h4>Shell.__writeStdErr</h4>
 <b>__writeStdErr</b>(<i>s</i>)
 <p>
--- a/QScintilla/Shell.py	Thu Aug 23 18:21:58 2018 +0200
+++ b/QScintilla/Shell.py	Sun Aug 26 15:03:20 2018 +0200
@@ -208,7 +208,7 @@
         if self.__showStdOutErr:
             dbs.clientProcessStdout.connect(self.__writeStdOut)
             dbs.clientProcessStderr.connect(self.__writeStdErr)
-        dbs.clientOutput.connect(self.__write)
+        dbs.clientOutput.connect(self.__writeQueued)
         dbs.clientStatement.connect(self.__clientStatement)
         dbs.clientGone.connect(self.__initialise)
         dbs.clientRawInput.connect(self.__raw_input)
@@ -906,9 +906,9 @@
         line = self.lines() - 1
         return (line, len(self.text(line)))
         
-    def __write(self, s):
+    def __writeQueued(self, s):
         """
-        Private method to display some text.
+        Private method to display some text using a write queue.
         
         @param s text to be displayed (string)
         """
@@ -916,7 +916,7 @@
 
     def __concatenateText(self, text):
         """
-        Private slot to get all available text and process it in one step.
+        Private slot to queue text and process it in one step.
         
         @param text text to be appended
         @type str
@@ -930,16 +930,25 @@
         QApplication.processEvents()
         
         # Finally process the accumulated text
+        self.__write(self.__queuedText)
+        
+        self.__queuedText = ''
+        self.__blockTextProcessing = False
+
+    def __write(self, s):
+        """
+        Private method to display some text without queuing.
+        
+        @param s text to be displayed
+        @type str
+        """
         line, col = self.__getEndPos()
         self.setCursorPosition(line, col)
-        self.insert(Utilities.filterAnsiSequences(self.__queuedText))
+        self.insert(Utilities.filterAnsiSequences(s))
         self.prline, self.prcol = self.getCursorPosition()
         self.ensureCursorVisible()
         self.ensureLineVisible(self.prline)
         
-        self.__queuedText = ''
-        self.__blockTextProcessing = False
-
     def __writeStdOut(self, s):
         """
         Private method to display some text with StdOut label.
@@ -963,6 +972,9 @@
         @param s prompt to be displayed (string)
         @param echo Flag indicating echoing of the input (boolean)
         """
+        # Get all text which is still waiting for output
+        QApplication.processEvents()
+        
         self.setFocus()
         self.inRawMode = True
         self.echoInput = echo

eric ide

mercurial