diff --git a/qtconsole/ansi_code_processor.py b/qtconsole/ansi_code_processor.py index 8fc8a795..8c3d3303 100644 --- a/qtconsole/ansi_code_processor.py +++ b/qtconsole/ansi_code_processor.py @@ -95,7 +95,7 @@ def split_string(self, string): # strings ending with \r are assumed to be ending in \r\n since # \n is appended to output strings automatically. Accounting # for that, here. - last_char = '\n' if len(string) > 0 and string[-1] == '\n' else None + last_char = None#'\n' if len(string) > 0 and string[-1] == '\n' else None string = string[:-1] if last_char is not None else string for match in ANSI_OR_SPECIAL_PATTERN.finditer(string): diff --git a/qtconsole/console_widget.py b/qtconsole/console_widget.py index a3052aed..643539ab 100644 --- a/qtconsole/console_widget.py +++ b/qtconsole/console_widget.py @@ -2221,7 +2221,8 @@ def _insert_plain_text(self, cursor, text, flush=False): elif act.action == 'newline': if not cursor.movePosition(QtGui.QTextCursor.NextBlock): - cursor.movePosition(QtGui.QTextCursor.EndOfLine) + cursor.movePosition(QtGui.QTextCursor.EndOfLine, + QtGui.QTextCursor.MoveAnchor) cursor.insertText('\n') # simulate replacement mode