shift + movement = selection

This commit is contained in:
Anthony Sottile
2019-12-31 22:15:57 -08:00
parent 6137fac556
commit a893bf0b93
3 changed files with 272 additions and 22 deletions

View File

@@ -48,3 +48,79 @@ def test_cut_uncut_multiple_file_buffers(tmpdir):
h.await_text_missing('world')
h.press('^U')
h.await_text('hello\ngood\nbye\n')
def test_selection_cut_uncut(ten_lines):
with run(str(ten_lines)) as h, and_exit(h):
h.press('Right')
h.press('S-Right')
h.press('S-Down')
h.press('^K')
h.await_cursor_position(x=1, y=1)
h.await_text('lne_1\n')
h.await_text_missing('line_0')
h.await_text(' *')
h.press('^U')
h.await_cursor_position(x=2, y=2)
h.await_text('line_0\nline_1')
def test_selection_cut_uncut_backwards_select(ten_lines):
with run(str(ten_lines)) as h, and_exit(h):
for _ in range(3):
h.press('Down')
h.press('Right')
h.press('S-Up')
h.press('S-Up')
h.press('S-Right')
h.press('^K')
h.await_text('line_0\nliine_3\nline_4\n')
h.await_cursor_position(x=2, y=2)
h.await_text(' *')
h.press('^U')
h.await_text('line_0\nline_1\nline_2\nline_3\nline_4\n')
h.await_cursor_position(x=1, y=4)
def test_selection_cut_uncut_within_line(ten_lines):
with run(str(ten_lines)) as h, and_exit(h):
h.press('Right')
h.press('S-Right')
h.press('S-Right')
h.press('^K')
h.await_text('le_0\n')
h.await_cursor_position(x=1, y=1)
h.await_text(' *')
h.press('^U')
h.await_text('line_0\n')
h.await_cursor_position(x=3, y=1)
def test_selection_cut_uncut_selection_offscreen_y(ten_lines):
with run(str(ten_lines), height=4) as h, and_exit(h):
for _ in range(3):
h.press('S-Down')
h.await_text_missing('line_0')
h.await_text('line_3')
h.press('^K')
h.await_text_missing('line_2')
h.await_cursor_position(x=0, y=1)
def test_selection_cut_uncut_selection_offscreen_x():
with run() as h, and_exit(h):
h.press(f'hello{"o" * 100}')
h.await_text_missing('hello')
h.press('Home')
h.await_text('hello')
for _ in range(5):
h.press('Right')
h.press('S-End')
h.await_text_missing('hello')
h.press('^K')
h.await_text('hello\n')

View File

@@ -16,5 +16,6 @@ def test_position_repr():
' sha256=None,\n'
' undo_stack=[],\n'
' redo_stack=[],\n'
' select_start=None,\n'
')'
)