Fix noop cut at end of file

Resolves #35
This commit is contained in:
Anthony Sottile
2020-02-27 16:11:27 -08:00
parent 21ada1750b
commit c248fb2d50
2 changed files with 10 additions and 1 deletions

View File

@@ -614,7 +614,7 @@ class File:
with self.edit_action_context('cut', final=False):
if self.y == len(self.lines) - 1:
return ()
return cut_buffer
else:
victim = self.lines.pop(self.y)
self.x = self.x_hint = 0

View File

@@ -33,6 +33,15 @@ def test_cut_end_of_file(run):
h.press('hi')
def test_cut_end_of_file_noop_extra_cut(run):
with run() as h, and_exit(h):
h.press('hi')
h.press('^K')
h.press('^K')
h.press('^U')
h.await_text('hi')
def test_cut_uncut_multiple_file_buffers(run, tmpdir):
f1 = tmpdir.join('f1')
f1.write('hello\nworld\n')