editor: Add the abort command

- For now it only unsets the current selection.
This commit is contained in:
Andrew Hamilton 2022-01-13 13:25:00 +10:00
parent 3c1e34ca5e
commit 0497a8f7a9
2 changed files with 10 additions and 1 deletions

View file

@ -540,6 +540,9 @@ class Editor:
def undo(self):
self.text_widget[:], self._cursor_x, self._cursor_y = self.history.pop()
def abort_command(self):
self.mark = None
def get_text(self):
return self.text_widget.get_text()
@ -644,7 +647,7 @@ class Editor:
terminal.CTRL_L: center_cursor, terminal.ALT_SEMICOLON: comment_lines,
terminal.ALT_c: cycle_syntax_highlighting, terminal.CTRL_X: prefix, terminal.ESC: quit,
terminal.CTRL_C: ctrl_c, terminal.CTRL_K: delete_line, terminal.TAB: tab_align,
terminal.CTRL_UNDERSCORE: undo}
terminal.CTRL_UNDERSCORE: undo, terminal.CTRL_G: abort_command}
def main():