Skip to content

Commit

Permalink
Handle args-out-of-range error in evil-repeat-start
Browse files Browse the repository at this point in the history
Fixes #1110
  • Loading branch information
tomdl89 committed Mar 24, 2024
1 parent a7ffa73 commit bc952d5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion evil-repeat.el
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
(when (evil-visual-state-p)
(let* ((range (evil-visual-range))
(beg (evil-range-beginning range))
(end (1- (evil-range-end range)))
(end (max 1 (1- (evil-range-end range))))
(nfwdlines (evil-count-lines beg end)))
(evil-repeat-record
(cond
Expand Down
14 changes: 12 additions & 2 deletions evil-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -1310,7 +1310,12 @@ evil\nrulz\nevil\nrulz\nevil\nrulz\nevil\nrulz\nevil\nrul[z]
("10IABC" [escape])
"ABCABCABCABCABCABCABCABCABCAB[C];; This buffer is for notes"
("11.")
"ABCABCABCABCABCABCABCABCABCABCAB[C]ABCABCABCABCABCABCABCABCABCABC;; This buffer is for notes")))
"ABCABCABCABCABCABCABCABCABCABCAB[C]ABCABCABCABCABCABCABCABCABCABC;; This buffer is for notes"))
(ert-info ("Repeat insert over empty lines")
(evil-test-buffer
""
("i" [return] [return] [return] [return] [return] [return] [escape] "gg\C-vGIX" [escape])
"X\nX\nX\nX\nX\nX\n")))

(ert-deftest evil-test-insert-line-vcount ()
"Test `evil-insert-line' with vertical repeating"
Expand Down Expand Up @@ -1370,7 +1375,12 @@ ABCABC{
("10AABC" [escape])
";; This buffer is for notes.ABCABCABCABCABCABCABCABCABCAB[C]"
("11.")
";; This buffer is for notes.ABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCAB[C]")))
";; This buffer is for notes.ABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCAB[C]"))
(ert-info ("Repeat append over empty lines")
(evil-test-buffer
""
("i" [return] [return] [return] [return] [return] [return] [escape] "gg\C-vGAX" [escape])
"X\nX\nX\nX\nX\nX\n")))

(ert-deftest evil-test-append-line-vcount ()
"Test `evil-append-line' with vertical repeating"
Expand Down

0 comments on commit bc952d5

Please sign in to comment.