* [rgm@gnu.org: mouse and horizontal scrolling with long lines]
@ 2006-11-30 3:21 Richard Stallman
2006-12-01 18:48 ` Chong Yidong
0 siblings, 1 reply; 6+ messages in thread
From: Richard Stallman @ 2006-11-30 3:21 UTC (permalink / raw)
Would someone please fix this, then ack?
------- Start of forwarded message -------
From: Glenn Morris <rgm@gnu.org>
To: emacs-pretest-bug@gnu.org
Date: Wed, 29 Nov 2006 04:42:09 -0500
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Subject: mouse and horizontal scrolling with long lines
X-Spam-Status: No, score=-2.8 required=5.0 tests=ALL_TRUSTED autolearn=failed
version=3.0.4
Scrolling with the mouse in a buffer with lines wider than the window
(with truncate-lines enabled) is problematic. As an example:
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.
Release the mouse.
Now point jumps to where the mouse cursor is, and the region between
here and where point just was gets selected. The window scrolls
horizontally again so as to centre the new point.
This last behaviour is unwanted, and makes it quite difficult to
scroll horizontally with the mouse, let along click and drag to create
a selection across the initial window edge.
_______________________________________________
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
------- End of forwarded message -------
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [rgm@gnu.org: mouse and horizontal scrolling with long lines]
2006-11-30 3:21 [rgm@gnu.org: mouse and horizontal scrolling with long lines] Richard Stallman
@ 2006-12-01 18:48 ` Chong Yidong
2006-12-01 23:30 ` Glenn Morris
0 siblings, 1 reply; 6+ messages in thread
From: Chong Yidong @ 2006-12-01 18:48 UTC (permalink / raw)
Cc: emacs-devel
> 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)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [rgm@gnu.org: mouse and horizontal scrolling with long lines]
2006-12-01 18:48 ` Chong Yidong
@ 2006-12-01 23:30 ` Glenn Morris
2006-12-02 0:06 ` Chong Yidong
0 siblings, 1 reply; 6+ messages in thread
From: Glenn Morris @ 2006-12-01 23:30 UTC (permalink / raw)
Cc: rms, emacs-devel
Chong Yidong wrote:
> Does this patch give good results?
Well, it's a definite improvement (thanks) in that a mouse click and
release near the margin no longer does an unwanted region selection.
However, now the down mouse event has no effect, and scrolling only
occurs on release of the mouse. I think it would be nicer if it were
the other way around. But maybe I'm just being greedy. :)
It is still hard to use the mouse to select a region that starts near
a window edge and requires horizontal scrolling (because the size of
the selection increases in jerks), but this is probably an inevitable
consequence of hscroll-step being 0. I should probably set my
hscroll-step to 1.
Or maybe I should turn off automatic-hscrolling altogether, to get a
behaviour similar to vertical mouse scrolling. But then even trying to
drag a selection past the edge of the window does not cause it to
scroll.
This is probably entering the "need horizontal scroll bars" territory,
which is obviously not a subject for this time.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [rgm@gnu.org: mouse and horizontal scrolling with long lines]
2006-12-01 23:30 ` Glenn Morris
@ 2006-12-02 0:06 ` Chong Yidong
2006-12-02 2:15 ` Glenn Morris
0 siblings, 1 reply; 6+ messages in thread
From: Chong Yidong @ 2006-12-02 0:06 UTC (permalink / raw)
Cc: rms, emacs-devel
Glenn Morris <rgm@gnu.org> writes:
> Well, it's a definite improvement (thanks) in that a mouse click and
> release near the margin no longer does an unwanted region selection.
> However, now the down mouse event has no effect, and scrolling only
> occurs on release of the mouse. I think it would be nicer if it were
> the other way around.
You mean, down-mouse causes a hscroll to center the text, then the
subsequent mouse-up hscrolls back? Wouldn't that be distracting
(especially if the down-mouse and mouse-up events occur in rapid
succession, in which case you'd just see a flicker)?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [rgm@gnu.org: mouse and horizontal scrolling with long lines]
2006-12-02 0:06 ` Chong Yidong
@ 2006-12-02 2:15 ` Glenn Morris
2006-12-02 2:25 ` Glenn Morris
0 siblings, 1 reply; 6+ messages in thread
From: Glenn Morris @ 2006-12-02 2:15 UTC (permalink / raw)
Cc: rms, emacs-devel
Chong Yidong wrote:
> Glenn Morris <rgm@gnu.org> writes:
[...]
>> However, now the down mouse event has no effect, and scrolling only
>> occurs on release of the mouse. I think it would be nicer if it were
>> the other way around.
>
> You mean, down-mouse causes a hscroll to center the text, then the
> subsequent mouse-up hscrolls back?
No, I mean I'd prefer down-mouse scroll, up-mouse do nothing.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-12-02 2:25 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-30 3:21 [rgm@gnu.org: mouse and horizontal scrolling with long lines] Richard Stallman
2006-12-01 18:48 ` Chong Yidong
2006-12-01 23:30 ` Glenn Morris
2006-12-02 0:06 ` Chong Yidong
2006-12-02 2:15 ` Glenn Morris
2006-12-02 2:25 ` Glenn Morris
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).