Changeset 3961

Show
Ignore:
Timestamp:
11/11/05 14:19:46 (3 years ago)
Author:
horiguti
Message:

Avoid setting the point on the line not fully displayed after scrolling.
Fixed ticket:208.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lisp/ChangeLog.Meadow

    r3947 r3961  
     12005-11-11  Kyotaro HORIGUCHI  <horiguti@meadowy.org> 
     2 
     3        * mw32scroll.el (scroll-but-point): Avoid setting the point on the 
     4         line not fully displayed after scrolling. Fixed ticket:208. 
     5        (w32-handle-mouse-wheel-event): Ditto. 
     6 
    172005-11-02  Hideyuki SHIRAI  <shirai@meadowy.org> 
    28 
  • trunk/lisp/mw32scroll.el

    r3934 r3961  
    141141 
    142142; 96.10.7 Created by himi 
    143 (defun scroll-but-point (line
     143(defun scroll-but-point (line &optional window
    144144  "Neglecting point, scroll current window. 
    145145If the point is out of the window, the point is moved to the 
    146 center of the window." 
    147   (save-excursion 
    148     (goto-char (window-start)) 
    149     (vertical-motion line) 
    150     (set-window-start (selected-window) (point)))) 
     146center of the window. 
     147If WINDOW is nil, scroll current window." 
     148  (save-selected-window 
     149    (if window (select-window window)) 
     150    (let ((opos (point))) 
     151      (goto-char (window-start)) 
     152      (vertical-motion line) 
     153      (set-window-start (selected-window) (point)) 
     154      (goto-char opos) 
     155 
     156      ;; If the point is on the line not fully displayed, move point 
     157      ;; out of wnidow to avoid unintentional scrolling on 
     158      ;; redrawing. 
     159      (if (let ((partial (pos-visible-in-window-p opos nil t))) 
     160            (and partial (nth 2 partial))) 
     161          (vertical-motion 1))))) 
    151162 
    152163(defun w32-handle-scroll-bar-event (event) 
     
    184195  "Handle W32 scroll bar events to do normal Window style scrolling." 
    185196  (interactive "e") 
    186   (let ((old-window (selected-window))) 
    187     (unwind-protect 
    188         (let* ((position (event-start event)) 
    189                (window (nth 0 position)) 
    190                (lines 
    191                 (w32-get-mouse-wheel-scroll-lines 
    192                  (nth 4 position))) 
    193                (window-scroll-step (- (window-height window) 
    194                                       next-screen-context-lines))) 
    195           (if (not lines) 
    196               (if (< (nth 4 position) 0) 
    197                   (setq lines 3) 
    198                 (setq lines -3))) 
    199           (if (<= window-scroll-step 0) 
    200               (setq window-scroll-step (window-height window))) 
    201           (cond 
    202            ((eq lines 'above-handle) 
    203             (setq lines (- window-scroll-step))) 
    204            ((eq lines 'below-handle) 
    205             (setq lines window-scroll-step))) 
    206           (if (windowp window) 
    207               (progn 
    208                 (select-window window) 
    209                 (scroll-but-point lines)))) 
    210             (select-window old-window)))) 
     197  (unwind-protect 
     198      (let* ((position (event-start event)) 
     199             (window (nth 0 position)) 
     200             (lines 
     201              (w32-get-mouse-wheel-scroll-lines 
     202               (nth 4 position))) 
     203             (window-scroll-step (- (window-height window) 
     204                                    next-screen-context-lines))) 
     205        (if (not lines) 
     206            (if (< (nth 4 position) 0) 
     207                (setq lines 3) 
     208              (setq lines -3))) 
     209        (if (<= window-scroll-step 0) 
     210            (setq window-scroll-step (window-height window))) 
     211        (cond 
     212         ((eq lines 'above-handle) 
     213          (setq lines (- window-scroll-step))) 
     214         ((eq lines 'below-handle) 
     215          (setq lines window-scroll-step))) 
     216        (if (windowp window) 
     217            (scroll-but-point lines window))))) 
    211218 
    212219(defun w32-handle-mouse-wheel-mode-line (event)