mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Backspace and delete now work in console
This commit is contained in:
parent
e7adf45c01
commit
a41f481ee7
@ -143,6 +143,8 @@ class Console(QTextEdit):
|
|||||||
Qt.Key_End : self.end_pressed,
|
Qt.Key_End : self.end_pressed,
|
||||||
Qt.Key_Left : self.left_pressed,
|
Qt.Key_Left : self.left_pressed,
|
||||||
Qt.Key_Right : self.right_pressed,
|
Qt.Key_Right : self.right_pressed,
|
||||||
|
Qt.Key_Backspace : self.backspace_pressed,
|
||||||
|
Qt.Key_Delete : self.delete_pressed,
|
||||||
} # }}}
|
} # }}}
|
||||||
|
|
||||||
motd = textwrap.dedent('''\
|
motd = textwrap.dedent('''\
|
||||||
@ -327,6 +329,22 @@ class Console(QTextEdit):
|
|||||||
self.setTextCursor(c)
|
self.setTextCursor(c)
|
||||||
self.ensureCursorVisible()
|
self.ensureCursorVisible()
|
||||||
|
|
||||||
|
def backspace_pressed(self):
|
||||||
|
lineno, pos = self.cursor_pos
|
||||||
|
if lineno < 0: return
|
||||||
|
if pos > self.prompt_len:
|
||||||
|
self.cursor.deletePreviousChar()
|
||||||
|
elif lineno > 0:
|
||||||
|
c = self.cursor
|
||||||
|
c.movePosition(c.Up)
|
||||||
|
c.movePosition(c.EndOfLine)
|
||||||
|
self.setTextCursor(c)
|
||||||
|
self.ensureCursorVisible()
|
||||||
|
|
||||||
|
def delete_pressed(self):
|
||||||
|
self.cursor.deleteChar()
|
||||||
|
self.ensureCursorVisible()
|
||||||
|
|
||||||
def right_pressed(self):
|
def right_pressed(self):
|
||||||
lineno, pos = self.cursor_pos
|
lineno, pos = self.cursor_pos
|
||||||
if lineno < 0: return
|
if lineno < 0: return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user