[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: address@hidden: mouse and horizontal scrolling with long lines]
From: |
Chong Yidong |
Subject: |
Re: address@hidden: mouse and horizontal scrolling with long lines] |
Date: |
Fri, 01 Dec 2006 13:48:55 -0500 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.91 (gnu/linux) |
> Scrolling with the mouse in a buffer with lines wider than the window
> (with truncate-lines enabled) is problematic.
>
> emacs -q --no-site-file
>
> Delete the newlines in the initial message in the scratch buffer (so
> as to get a single long line of text wider than the window).
>
> M-x toggle-truncate-lines
>
> Click with the mouse within 5 columns of the right margin, but do not
> release the mouse button.
>
> At this stage, the window scrolls to centre point horizontally.
> The mouse cursor remains where it was, close to the right margin.
> The buffer basically looks as one would want it to.
Does this patch give good results?
*** emacs/lisp/mouse.el.~1.307.~ 2006-11-27 10:34:35.000000000 -0500
--- emacs/lisp/mouse.el 2006-12-01 13:47:12.000000000 -0500
***************
*** 925,931 ****
(click-count (1- (event-click-count start-event)))
(remap-double-click (and on-link
(eq mouse-1-click-follows-link 'double)
! (= click-count 1))))
(setq mouse-selection-click-count click-count)
;; In case the down click is in the middle of some intangible text,
;; use the end of that text, and put it in START-POINT.
--- 925,933 ----
(click-count (1- (event-click-count start-event)))
(remap-double-click (and on-link
(eq mouse-1-click-follows-link 'double)
! (= click-count 1)))
! (automatic-hscrolling-saved automatic-hscrolling)
! (automatic-hscrolling nil))
(setq mouse-selection-click-count click-count)
;; In case the down click is in the middle of some intangible text,
;; use the end of that text, and put it in START-POINT.
***************
*** 946,951 ****
--- 948,960 ----
(memq (car-safe event) '(switch-frame select-window))))
(if (memq (car-safe event) '(switch-frame select-window))
nil
+ ;; We suppress automatic hscrolling initially, which would
+ ;; otherwise it would occur during the `read-event' call;
+ ;; otherwise, it would interfere with the act of setting
+ ;; point in text near the right fringe. However, if the
+ ;; mouse is dragged, we go ahead and perform the hscroll.
+ (let ((automatic-hscrolling automatic-hscrolling-saved))
+ (redisplay))
(setq end (event-end event)
end-point (posn-point end))
(if (numberp end-point)
- Re: address@hidden: mouse and horizontal scrolling with long lines],
Chong Yidong <=