* 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)
(cherry picked from commit
6491fee366f58a831689c57aa31493dd70bc2245)
(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)
(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
"