Fix out of bounds on uncomment

This commit is contained in:
Anthony Sottile
2020-08-28 20:49:14 -07:00
parent 29062628f9
commit 055d738142
2 changed files with 30 additions and 1 deletions

View File

@@ -73,3 +73,27 @@ def test_comment_with_trailing_whitespace(run, ten_lines):
h.press_and_enter(':comment // ')
h.await_text('// line_0\nline_1\n')
def test_comment_cursor_at_end_of_line(run, ten_lines):
with run(str(ten_lines)) as h, and_exit(h):
h.press('# ')
h.press('End')
h.await_cursor_position(x=8, y=1)
trigger_command_mode(h)
h.press_and_enter(':comment')
h.await_cursor_position(x=6, y=1)
def test_add_comment_moves_cursor(run, ten_lines):
with run(str(ten_lines)) as h, and_exit(h):
h.press('End')
h.await_cursor_position(x=6, y=1)
trigger_command_mode(h)
h.press_and_enter(':comment')
h.await_cursor_position(x=8, y=1)