mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 17:24:23 +00:00
Fix string end search in python-nav-end-of-statement
* lisp/progmodes/python.el (python-nav-end-of-statement): Change to look for string delimiter characters and check syntax, instead of looking for string-delimiter syntax. * test/lisp/progmodes/python-tests.el (python-nav-end-of-statement-5): New test. (Bug#75387)
This commit is contained in:
parent
0f768b8843
commit
6491fee366
2 changed files with 29 additions and 2 deletions
|
|
@ -2328,8 +2328,11 @@ of the statement."
|
|||
(setq
|
||||
last-string-end
|
||||
(or (if (eq t (nth 3 (syntax-ppss)))
|
||||
(re-search-forward
|
||||
(rx (syntax string-delimiter)) nil t)
|
||||
(cl-loop
|
||||
while (re-search-forward
|
||||
(rx (or "\"\"\"" "'''")) nil t)
|
||||
unless (python-syntax-context 'string)
|
||||
return (point))
|
||||
(ignore-error scan-error
|
||||
(goto-char string-start)
|
||||
(python-nav--lisp-forward-sexp)
|
||||
|
|
|
|||
|
|
@ -3204,6 +3204,30 @@ d = '''d'''
|
|||
(python-tests-look-at "c'")
|
||||
(pos-eol))))))
|
||||
|
||||
(ert-deftest python-nav-end-of-statement-5 ()
|
||||
"Test long multi-line string (Bug#75387)."
|
||||
(let* ((line (format "%s\n" (make-string 80 ?a)))
|
||||
(lines (apply #'concat (make-list 50 line))))
|
||||
(python-tests-with-temp-buffer
|
||||
(concat
|
||||
"
|
||||
s = '''
|
||||
"
|
||||
lines
|
||||
"\\'''"
|
||||
lines
|
||||
"'''
|
||||
a = 1
|
||||
")
|
||||
(python-tests-look-at "s = '''")
|
||||
(should (= (save-excursion
|
||||
(python-nav-end-of-statement)
|
||||
(point))
|
||||
(save-excursion
|
||||
(python-tests-look-at "a = 1")
|
||||
(forward-line -1)
|
||||
(pos-eol)))))))
|
||||
|
||||
(ert-deftest python-nav-forward-statement-1 ()
|
||||
(python-tests-with-temp-buffer
|
||||
"
|
||||
|
|
|
|||
Loading…
Reference in a new issue