Skip to content

Commit

Permalink
Fix jumping to next/prev paren/brace from a string is not working (#1849
Browse files Browse the repository at this point in the history
)
  • Loading branch information
mihaicristiantanase authored Dec 15, 2023
1 parent 16506d9 commit eced308
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 2 deletions.
4 changes: 2 additions & 2 deletions evil-common.el
Original file line number Diff line number Diff line change
Expand Up @@ -1360,11 +1360,11 @@ last successful match (that caused COUNT to reach zero)."
(cond
((> dir 0)
(while (progn
(up-list dir)
(up-list dir t)
(/= (char-before) close))))
(t
(while (progn
(up-list dir)
(up-list dir t)
(/= (char-after) open)))))
(error (goto-char pnt)))))))
(cond
Expand Down
83 changes: 83 additions & 0 deletions evil-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -5874,6 +5874,89 @@ This buffer is for notes."
("2])")
"foo ( { ( bar ) baz } [)]")))

(ert-deftest evil-test-paren-jump-from-string ()
"Test jump to next/prev paren from a string"
:tags '(evil motion)
(evil-test-buffer
"{
fun(a, \"T[]est\", test());
}
"
("[(")
"{
fun[(]a, \"Test\", test());
}
"
("])")
"{
fun(a, \"Test\", test()[)];
}
")
(evil-test-buffer
"{
fun(a, \"T[]est\", test());
}
"
("])")
"{
fun(a, \"Test\", test()[)];
}
"
("[(")
"{
fun[(]a, \"Test\", test());
}
")
(evil-test-buffer
"{
fun(a, \"T[]est\", test());
}
"
("[{")
"[{]
fun(a, \"Test\", test());
}
")
(evil-test-buffer
"{
fun(a, \"T[]est\", test());
}
"
("]}")
"{
fun(a, \"Test\", test());
[}]
"))

(ert-deftest evil-test-paren-jump-inside-string-from-string ()
"Test jump to next/prev paren inside string from a string"
:tags '(evil motion)
(evil-test-buffer
"{ (\"Test with paren (inside multi (l[e]vel))\", test()); } "
("[(")
"{ (\"Test with paren (inside multi [(]level))\", test()); } "
("[(")
"{ (\"Test with paren [(]inside multi (level))\", test()); } ")
(evil-test-buffer
"{ (\"Test with paren (inside multi (l[e]vel))\", test()); } "
("])")
"{ (\"Test with paren (inside multi (level[)])\", test()); } "
("])")
"{ (\"Test with paren (inside multi (level)[)]\", test()); } ")
(evil-test-buffer
"{ (\"Test with paren {inside multi {l[e]vel}}\", test()); } "
("[{")
"{ (\"Test with paren {inside multi [{]level}}\", test()); } "
("[{")
"{ (\"Test with paren [{]inside multi {level}}\", test()); } ")
(evil-test-buffer
"{ (\"Test with paren {inside multi {l[e]vel}}\", test()); } "
("]}")
"{ (\"Test with paren {inside multi {level[}]}\", test()); } "
("]}")
"{ (\"Test with paren {inside multi {level}[}]\", test()); } "))


(ert-deftest evil-test-next-mark ()
"Test `evil-next-mark', `evil-previous-mark'"
:tags '(evil motion)
Expand Down

0 comments on commit eced308

Please sign in to comment.