editor: Add delete line command. (ctrl-k)

This commit is contained in:
Andrew Hamilton 2022-01-07 11:15:30 +10:00
parent c66f79ea3d
commit 5e23b974f7
2 changed files with 20 additions and 1 deletions

View file

@ -150,6 +150,17 @@ class EditorTestCase(unittest.TestCase):
(self.editor.join_lines, "ab- -cd ", (0, 0)),
(self.editor.join_lines, "ab- -cd ", (0, 0))])
def test_delete_line(self):
text = "a \ndef"
self._set_editor(text, (1, 0))
self._assert_changes([(self.editor.delete_line, "adef", (1, 0)),
(self.editor.delete_line, "a", (1, 0))])
text = "\nabc"
self._set_editor(text, (0, 0))
self._assert_changes([(self.editor.delete_line, "abc", (0, 0)),
(self.editor.delete_line, "", (0, 0)),
(self.editor.delete_line, "", (0, 0))])
if __name__ == "__main__":
unittest.main()