From 44ca27270bdd7786ddb36469149128b6d18aac9a Mon Sep 17 00:00:00 2001 From: dickmao Date: Tue, 15 Nov 2022 16:03:48 -0500 Subject: [PATCH] Temporary goal column leaks * lisp/simple.el (temporary-goal-column): Buffer-localize. * test/lisp/simple-tests.el (line-move-visual-goal-column-leakage): Test it. --- lisp/simple.el | 2 +- test/lisp/simple-tests.el | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lisp/simple.el b/lisp/simple.el index 0f44b14948c..fa4a7f0638d 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -7463,7 +7463,7 @@ goal-column :group 'editing-basics) (make-variable-buffer-local 'goal-column) -(defvar temporary-goal-column 0 +(defvar-local temporary-goal-column 0 "Current goal column for vertical motion. It is the column where point was at the start of the current run of vertical motion commands. diff --git a/test/lisp/simple-tests.el b/test/lisp/simple-tests.el index d067f3e586e..e3ecec287d7 100644 --- a/test/lisp/simple-tests.el +++ b/test/lisp/simple-tests.el @@ -1045,5 +1045,15 @@ simple-tests-zap-to-char (with-zap-to-char-test "abcdeCXYZ" "XYZ" (zap-to-char 1 ?C 'interactive)))) +(ert-deftest line-move-visual-goal-column-leakage () + (skip-unless (not noninteractive)) + (with-temp-buffer + (save-excursion (insert "עִבְרִית\nעִבְרִית")) + (call-interactively #'next-line) + (with-temp-buffer + (save-excursion (insert "English\nEnglish")) + (call-interactively #'next-line) + (should (zerop (current-column)))))) + (provide 'simple-test) ;;; simple-tests.el ends here -- 2.36.1