diff options
| author | Chong Yidong | 2009-07-31 02:14:43 +0000 |
|---|---|---|
| committer | Chong Yidong | 2009-07-31 02:14:43 +0000 |
| commit | 34be836cc766642b8feab129ac7709cfa3f7a12b (patch) | |
| tree | 14be4c9cacbc9d04531aba54fa87d6731764d2d7 | |
| parent | 54b99340fdedcaabf52feaca573dc3020292dfa7 (diff) | |
| download | emacs-34be836cc766642b8feab129ac7709cfa3f7a12b.tar.gz emacs-34be836cc766642b8feab129ac7709cfa3f7a12b.zip | |
* simple.el (line-move-visual): Perform hscroll to the recorded position.
| -rw-r--r-- | lisp/ChangeLog | 1 | ||||
| -rw-r--r-- | lisp/simple.el | 41 |
2 files changed, 22 insertions, 20 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 93201ac101c..000d87414b6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | * simple.el (line-move-finish): Pass whole number to | 3 | * simple.el (line-move-finish): Pass whole number to |
| 4 | line-move-to-column. | 4 | line-move-to-column. |
| 5 | (line-move-visual): Perform hscroll to the recorded position. | ||
| 5 | 6 | ||
| 6 | 2009-07-30 Jay Belanger <jay.p.belanger@gmail.com> | 7 | 2009-07-30 Jay Belanger <jay.p.belanger@gmail.com> |
| 7 | 8 | ||
diff --git a/lisp/simple.el b/lisp/simple.el index 3c779269f4d..954009e6609 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -4092,29 +4092,30 @@ into account variable-width characters and line continuation." | |||
| 4092 | ;; Arg says how many lines to move. The value is t if we can move the | 4092 | ;; Arg says how many lines to move. The value is t if we can move the |
| 4093 | ;; specified number of lines. | 4093 | ;; specified number of lines. |
| 4094 | (defun line-move-visual (arg &optional noerror) | 4094 | (defun line-move-visual (arg &optional noerror) |
| 4095 | (let ((posn (posn-at-point)) | 4095 | (let ((opoint (point)) |
| 4096 | (opoint (point)) | ||
| 4097 | (hscroll (window-hscroll)) | 4096 | (hscroll (window-hscroll)) |
| 4098 | x) | 4097 | target-hscroll) |
| 4099 | ;; Check if the previous command was a line-motion command, or if | 4098 | ;; Check if the previous command was a line-motion command, or if |
| 4100 | ;; we were called from some other command. | 4099 | ;; we were called from some other command. |
| 4101 | (cond ((and (consp temporary-goal-column) | 4100 | (if (and (consp temporary-goal-column) |
| 4102 | (memq last-command `(next-line previous-line ,this-command))) | 4101 | (memq last-command `(next-line previous-line ,this-command))) |
| 4103 | ;; If so, there's no need to reset `temporary-goal-column', | 4102 | ;; If so, there's no need to reset `temporary-goal-column', |
| 4104 | ;; unless the window hscroll has changed. | 4103 | ;; but we may need to hscroll. |
| 4105 | (when (/= hscroll (cdr temporary-goal-column)) | 4104 | (if (or (/= (cdr temporary-goal-column) hscroll) |
| 4106 | (set-window-hscroll nil 0) | 4105 | (> (cdr temporary-goal-column) 0)) |
| 4107 | (setq temporary-goal-column | 4106 | (setq target-hscroll (cdr temporary-goal-column))) |
| 4108 | (cons (+ (car temporary-goal-column) | 4107 | ;; Otherwise, we should reset `temporary-goal-column'. |
| 4109 | (cdr temporary-goal-column)) 0)))) | 4108 | (let ((posn (posn-at-point))) |
| 4110 | ;; Otherwise, we should reset `temporary-goal-column'. | 4109 | (cond |
| 4111 | ;; Handle the `overflow-newline-into-fringe' case: | 4110 | ;; Handle the `overflow-newline-into-fringe' case: |
| 4112 | ((eq (nth 1 posn) 'right-fringe) | 4111 | ((eq (nth 1 posn) 'right-fringe) |
| 4113 | (setq temporary-goal-column (cons (- (window-width) 1) hscroll))) | 4112 | (setq temporary-goal-column (cons (- (window-width) 1) hscroll))) |
| 4114 | ((setq x (car (posn-x-y posn))) | 4113 | ((car (posn-x-y posn)) |
| 4115 | (setq temporary-goal-column | 4114 | (setq temporary-goal-column |
| 4116 | (cons (/ (float x) (frame-char-width)) hscroll)))) | 4115 | (cons (/ (float (car (posn-x-y posn))) |
| 4117 | ;; Move using `vertical-motion'. | 4116 | (frame-char-width)) hscroll)))))) |
| 4117 | (if target-hscroll | ||
| 4118 | (set-window-hscroll (selected-window) target-hscroll)) | ||
| 4118 | (or (and (= (vertical-motion | 4119 | (or (and (= (vertical-motion |
| 4119 | (cons (or goal-column | 4120 | (cons (or goal-column |
| 4120 | (if (consp temporary-goal-column) | 4121 | (if (consp temporary-goal-column) |