diff options
| author | Chong Yidong | 2009-04-25 15:27:45 +0000 |
|---|---|---|
| committer | Chong Yidong | 2009-04-25 15:27:45 +0000 |
| commit | 624a662f9acc017f0fc74fc4b98eb7cb8e73c165 (patch) | |
| tree | 081933b92c4938f38ff9cfb0592893ea4ba3985d | |
| parent | af17b9836bbee39c102c0fcc5579d6839e7272ec (diff) | |
| download | emacs-624a662f9acc017f0fc74fc4b98eb7cb8e73c165.tar.gz emacs-624a662f9acc017f0fc74fc4b98eb7cb8e73c165.zip | |
* simple.el (line-move-visual): If point is stuck moving backwards
against a display string, temporarily ignore the goal
column (Bug#3020).
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/simple.el | 39 |
2 files changed, 27 insertions, 16 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d8ed4e20181..e77abd01379 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2009-04-25 Chong Yidong <cyd@stupidchicken.com> | 1 | 2009-04-25 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 2 | ||
| 3 | * simple.el (line-move-visual): If point is stuck moving backwards | ||
| 4 | against a display string, temporarily ignore the goal | ||
| 5 | column (Bug#3020). | ||
| 6 | |||
| 3 | * startup.el (normal-top-level): Implement a work-around to handle | 7 | * startup.el (normal-top-level): Implement a work-around to handle |
| 4 | changes to face-font-rescale-alist during | 8 | changes to face-font-rescale-alist during |
| 5 | initialization (Bug#1785). | 9 | initialization (Bug#1785). |
diff --git a/lisp/simple.el b/lisp/simple.el index fd281429032..082605f659d 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -4056,24 +4056,31 @@ into account variable-width characters and line continuation." | |||
| 4056 | ;; Arg says how many lines to move. The value is t if we can move the | 4056 | ;; Arg says how many lines to move. The value is t if we can move the |
| 4057 | ;; specified number of lines. | 4057 | ;; specified number of lines. |
| 4058 | (defun line-move-visual (arg &optional noerror) | 4058 | (defun line-move-visual (arg &optional noerror) |
| 4059 | (unless (and (floatp temporary-goal-column) | 4059 | (let ((posn (posn-at-point)) |
| 4060 | (or (memq last-command '(next-line previous-line)) | 4060 | (opoint (point)) |
| 4061 | ;; In case we're called from some other command. | 4061 | x) |
| 4062 | (eq last-command this-command))) | 4062 | ;; Reset temporary-goal-column, unless the previous command was a |
| 4063 | (let ((posn (posn-at-point)) | 4063 | ;; line-motion command or we were called from some other command. |
| 4064 | x) | 4064 | (unless (and (floatp temporary-goal-column) |
| 4065 | (memq last-command `(next-line previous-line ,this-command))) | ||
| 4065 | (cond ((eq (nth 1 posn) 'right-fringe) ; overflow-newline-into-fringe | 4066 | (cond ((eq (nth 1 posn) 'right-fringe) ; overflow-newline-into-fringe |
| 4066 | (setq temporary-goal-column (- (window-width) 1))) | 4067 | (setq temporary-goal-column (- (window-width) 1))) |
| 4067 | ((setq x (car (nth 2 posn))) | 4068 | ((setq x (car (posn-x-y posn))) |
| 4068 | (setq temporary-goal-column (/ (float x) (frame-char-width))))))) | 4069 | (setq temporary-goal-column (/ (float x) (frame-char-width)))))) |
| 4069 | (or (= (vertical-motion | 4070 | ;; Move using `vertical-motion'. |
| 4070 | (cons (or goal-column (truncate temporary-goal-column)) arg)) | 4071 | (or (and (= (vertical-motion |
| 4071 | arg) | 4072 | (cons (or goal-column (truncate temporary-goal-column)) arg)) |
| 4072 | (unless noerror | 4073 | arg) |
| 4073 | (signal (if (< arg 0) | 4074 | (or (>= arg 0) |
| 4074 | 'beginning-of-buffer | 4075 | (/= (point) opoint) |
| 4075 | 'end-of-buffer) | 4076 | ;; If the goal column lies on a display string, |
| 4076 | nil)))) | 4077 | ;; `vertical-motion' advances the cursor to the end |
| 4078 | ;; of the string. For arg < 0, this can cause the | ||
| 4079 | ;; cursor to get stuck. (Bug#3020). | ||
| 4080 | (= (vertical-motion arg) arg))) | ||
| 4081 | (unless noerror | ||
| 4082 | (signal (if (< arg 0) 'beginning-of-buffer 'end-of-buffer) | ||
| 4083 | nil))))) | ||
| 4077 | 4084 | ||
| 4078 | ;; This is the guts of next-line and previous-line. | 4085 | ;; This is the guts of next-line and previous-line. |
| 4079 | ;; Arg says how many lines to move. | 4086 | ;; Arg says how many lines to move. |