diff -r ca90aee56d20 -r 56d3b6722b3c QScintilla/Shell.py --- a/QScintilla/Shell.py Fri Jun 08 19:34:28 2018 +0200 +++ b/QScintilla/Shell.py Sat Jun 09 12:08:47 2018 +0200 @@ -108,9 +108,11 @@ result @signal historyStyleChanged(ShellHistoryStyle) emitted to indicate a change of the history style + @signal queueText(str) emitted to queue some text for processing """ searchStringFound = pyqtSignal(bool) historyStyleChanged = pyqtSignal(ShellHistoryStyle) + queueText = pyqtSignal(str) def __init__(self, dbs, vm, windowedVariant, parent=None): """ @@ -343,6 +345,10 @@ self.__historyNavigateByCursor = \ Preferences.getShell("HistoryNavigateByCursor") + self.__queuedText = '' + self.__blockTextProcessing = False + self.queueText.connect(self.__concatenateText, Qt.QueuedConnection) + self.grabGesture(Qt.PinchGesture) def __showLanguageMenu(self): @@ -904,13 +910,34 @@ @param s text to be displayed (string) """ + self.queueText.emit(s) + + def __concatenateText(self, text): + """ + Private slot to get all available text and process it in one step. + + @param text text to be appended + @type str + """ + self.__queuedText += text + if self.__blockTextProcessing: + return + + self.__blockTextProcessing = True + # Get all text which is still waiting for output + QApplication.processEvents() + + # Finally process the accumulated text line, col = self.__getEndPos() self.setCursorPosition(line, col) - self.insert(Utilities.filterAnsiSequences(s)) + self.insert(Utilities.filterAnsiSequences(self.__queuedText)) 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.