unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
Cc: emacs-devel@gnu.org
Subject: Re: [rgm@gnu.org: mouse and horizontal scrolling with long lines]
Date: Fri, 01 Dec 2006 13:48:55 -0500	[thread overview]
Message-ID: <87hcwfih9k.fsf@stupidchicken.com> (raw)
In-Reply-To: <E1GpcUC-0006ZV-De@fencepost.gnu.org> (Richard Stallman's message of "Wed\, 29 Nov 2006 22\:21\:20 -0500")

> 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)

  reply	other threads:[~2006-12-01 18:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-30  3:21 [rgm@gnu.org: mouse and horizontal scrolling with long lines] Richard Stallman
2006-12-01 18:48 ` Chong Yidong [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87hcwfih9k.fsf@stupidchicken.com \
    --to=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).