From 950f592b87173daaeb84244560c276adb0cb49f8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 22 Sep 2010 21:48:17 -0600 Subject: [PATCH] ... --- src/calibre/utils/pyconsole/console.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/calibre/utils/pyconsole/console.py b/src/calibre/utils/pyconsole/console.py index 1acb6e96a9..2611965345 100644 --- a/src/calibre/utils/pyconsole/console.py +++ b/src/calibre/utils/pyconsole/console.py @@ -268,6 +268,11 @@ class Console(QTextEdit): return property(fget=fget, fset=fset, doc=doc) + def move_cursor_to_prompt(self): + if self.prompt_frame is not None and self.cursor_pos[0] < 0: + c = self.prompt_frame.lastCursorPosition() + self.setTextCursor(c) + def prompt(self, strip_prompt_strings=True): if not self.prompt_frame: yield u'' if strip_prompt_strings else self.formatter.prompt @@ -453,6 +458,7 @@ class Console(QTextEdit): def text_typed(self, text): if self.prompt_frame is not None: + self.move_cursor_to_prompt() self.cursor.insertText(text) self.render_current_prompt(restore_cursor=True)