comparison lisp/simple.el @ 73109:4a02fd618570

* simple.el (line-move-finish): Handle corner case for fields in continued lines. (line-move-1): Remove flawed test for that case.
author Chong Yidong <cyd@stupidchicken.com>
date Sun, 24 Sep 2006 21:58:12 +0000
parents b584d304b053
children 1b3313de1c4c
comparison
equal deleted inserted replaced
73108:e6a2cb7ec280 73109:4a02fd618570
3602 ;; We don't use `end-of-line', since we want to escape 3602 ;; We don't use `end-of-line', since we want to escape
3603 ;; from field boundaries ocurring exactly at point. 3603 ;; from field boundaries ocurring exactly at point.
3604 (let ((inhibit-field-text-motion t)) 3604 (let ((inhibit-field-text-motion t))
3605 (setq line-end (line-end-position))) 3605 (setq line-end (line-end-position)))
3606 (goto-char (constrain-to-field line-end (point) t t)) 3606 (goto-char (constrain-to-field line-end (point) t t))
3607 ;; When moving a single line, update the goal-column
3608 ;; if we couldn't move to the end of line due to a
3609 ;; field boundary. Otherwise we'll get stuck at the
3610 ;; original position during the column motion in
3611 ;; line-move-finish.
3612 (and (/= line-end (point))
3613 (= orig-arg 1)
3614 (setq temporary-goal-column
3615 (max temporary-goal-column (current-column))))
3616 ;; If there's no invisibility here, move over the newline. 3607 ;; If there's no invisibility here, move over the newline.
3617 (cond 3608 (cond
3618 ((eobp) 3609 ((eobp)
3619 (if (not noerror) 3610 (if (not noerror)
3620 (signal 'end-of-buffer nil) 3611 (signal 'end-of-buffer nil)
3677 (while repeat 3668 (while repeat
3678 ;; Set REPEAT to t to repeat the whole thing. 3669 ;; Set REPEAT to t to repeat the whole thing.
3679 (setq repeat nil) 3670 (setq repeat nil)
3680 3671
3681 (let (new 3672 (let (new
3673 (old (point))
3682 (line-beg (save-excursion (beginning-of-line) (point))) 3674 (line-beg (save-excursion (beginning-of-line) (point)))
3683 (line-end 3675 (line-end
3684 ;; Compute the end of the line 3676 ;; Compute the end of the line
3685 ;; ignoring effectively invisible newlines. 3677 ;; ignoring effectively invisible newlines.
3686 (save-excursion 3678 (save-excursion
3691 (skip-chars-forward "^\n")) 3683 (skip-chars-forward "^\n"))
3692 (point)))) 3684 (point))))
3693 3685
3694 ;; Move to the desired column. 3686 ;; Move to the desired column.
3695 (line-move-to-column column) 3687 (line-move-to-column column)
3688
3689 ;; Corner case: suppose we start out in a field boundary in
3690 ;; the middle of a continued line. When we get to
3691 ;; line-move-finish, point is at the start of a new *screen*
3692 ;; line but the same text line; then line-move-to-column would
3693 ;; move us backwards. Test using C-n with point on the "x" in
3694 ;; (insert "a" (propertize "x" 'field t) (make-string 89 ?y))
3695 (and forward
3696 (< (point) old)
3697 (goto-char old))
3698
3696 (setq new (point)) 3699 (setq new (point))
3697 3700
3698 ;; Process intangibility within a line. 3701 ;; Process intangibility within a line.
3699 ;; With inhibit-point-motion-hooks bound to nil, a call to 3702 ;; With inhibit-point-motion-hooks bound to nil, a call to
3700 ;; goto-char moves point past intangible text. 3703 ;; goto-char moves point past intangible text.