Fix bug #9607 with vertical motion when auto-hscroll-mode is disabled.
authorEli Zaretskii <eliz@gnu.org>
Thu, 29 Sep 2011 13:03:42 +0000 (16:03 +0300)
committerEli Zaretskii <eliz@gnu.org>
Thu, 29 Sep 2011 13:03:42 +0000 (16:03 +0300)
 lisp/simple.el (line-move): If auto-hscroll-mode is disabled and the
 window is hscrolled, move by logical lines.
 (line-move-visual): Update the doc string to the above effect.

lisp/ChangeLog
lisp/simple.el

index b217a90..42bd140 100644 (file)
@@ -1,3 +1,9 @@
+2011-09-29  Eli Zaretskii  <eliz@gnu.org>
+
+       * simple.el (line-move): If auto-hscroll-mode is disabled and the
+       window is hscrolled, move by logical lines.  (Bug#9607)
+       (line-move-visual): Update the doc string to the above effect.
+
 2011-09-29  Martin Rudalics  <rudalics@gmx.at>
 
        * window.el (display-buffer-record-window): When WINDOW is the
index 14ce5ed..1ab9079 100644 (file)
@@ -4244,7 +4244,9 @@ screen, instead of relying on buffer contents alone.  It takes
 into account variable-width characters and line continuation.
 If nil, `line-move' moves point by logical lines.
 A non-nil setting of `goal-column' overrides the value of this variable
-and forces movement by logical lines."
+and forces movement by logical lines.
+Disabling `auto-hscroll-mode' also overrides forces movement by logical
+lines when the window is horizontally scrolled."
   :type 'boolean
   :group 'editing-basics
   :version "23.1")
@@ -4321,7 +4323,15 @@ and forces movement by logical lines."
               (not executing-kbd-macro)
               (line-move-partial arg noerror to-end))
     (set-window-vscroll nil 0 t)
-    (if (and line-move-visual (not goal-column))
+    (if (and line-move-visual
+            ;; Display-based column are incompatible with goal-column.
+            (not goal-column)
+            ;; When auto-hscroll-mode is turned off and the text in
+            ;; the window is scrolled to the left, display-based
+            ;; motion doesn't make sense (because each logical line
+            ;; occupies exactly one screen line).
+            (not (and (null auto-hscroll-mode)
+                      (> (window-hscroll) 0))))
        (line-move-visual arg noerror)
       (line-move-1 arg noerror to-end))))