From 18ff6ea06a0a86eb72f25f88b3746900f39b1cd6 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 3 Oct 2014 12:37:32 +0200 Subject: [PATCH] Fix line breaking in debugging console. Fixes #144. --- qutebrowser/widgets/console.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/qutebrowser/widgets/console.py b/qutebrowser/widgets/console.py index 5b9a51840..b7fe928d2 100644 --- a/qutebrowser/widgets/console.py +++ b/qutebrowser/widgets/console.py @@ -86,7 +86,7 @@ class ConsoleLineEdit(misc.CommandLineEdit): """Push a line to the interpreter.""" self._buffer.append(line) source = '\n'.join(self._buffer) - self.write.emit(self._curprompt() + line) + self.write.emit(self._curprompt() + line + '\n') # We do two special things with the contextmanagers here: # - We replace stdout/stderr to capture output. Even if we could # override InteractiveInterpreter's write method, most things are @@ -170,16 +170,6 @@ class ConsoleTextEdit(QTextEdit): """Update font when config changed.""" self.setFont(config.get('fonts', 'debug-console')) - def append_plaintext(self, text): - """Append new text to the output. - - Note we can't use QTextEdit::append as this parses HTML. - - Args: - text: The text to append. - """ - self.insertPlainText('\n' + text) - class ConsoleWidget(QWidget): @@ -195,7 +185,7 @@ class ConsoleWidget(QWidget): super().__init__(parent) self._lineedit = ConsoleLineEdit(self) self._output = ConsoleTextEdit() - self._lineedit.write.connect(self._output.append_plaintext) + self._lineedit.write.connect(self._output.insertPlainText) self._vbox = QVBoxLayout() self._vbox.setSpacing(0) self._vbox.addWidget(self._output)