emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rampant region highlighting


From: Chong Yidong
Subject: Re: rampant region highlighting
Date: Mon, 07 Apr 2008 00:30:17 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Chong Yidong <address@hidden> writes:

> Glenn Morris <address@hidden> writes:
>
>> Current CVS trunk:
>>
>> ./src/emacs -Q README  --eval '(transient-mark-mode -1)'
>>
>> Double-click with left mouse to select the word "tree" from "This
>> directory tree...". The word "tree" is highlighted with region face.
>>
>> Scroll down with mouse-wheel so that "tree" goes off the top of the
>> screen.
>>
>> Scroll back up with mouse-wheel.
>>
>> Now the region has been extended to cover a lot more text. The further
>> I scroll down initially, the more is highlighted.
>
> I guess mwheel-scroll should unconditionally deactivate the mark when
> tmm is active.  I'll take a look.

I think the way to handle this is to make mouse wheel scrolling preserve
any temporarily active region iff point isn't moved.  Does this patch
give good results for you?

*** trunk/lisp/mwheel.el.~1.44.~        2008-01-08 15:44:42.000000000 -0500
--- trunk/lisp/mwheel.el        2008-04-07 00:26:48.000000000 -0400
***************
*** 190,195 ****
--- 190,201 ----
                       (prog1
                           (selected-window)
                         (select-window (mwheel-event-window event)))))
+        (buffer (window-buffer curwin))
+        ;; If there is a temporarily active region, we may want to
+        ;; deactivate it.  Save the original value of point.
+        (opoint (with-current-buffer buffer
+                  (when (eq (car-safe transient-mark-mode) 'only)
+                    (point))))
           (mods
          (delq 'click (delq 'double (delq 'triple (event-modifiers event)))))
           (amt (assoc mods mouse-wheel-scroll-amount)))
***************
*** 224,230 ****
                     ;; Make sure we do indeed scroll to the end of the buffer.
                     (end-of-buffer (while t (scroll-up)))))
                (t (error "Bad binding in mwheel-scroll"))))
!       (if curwin (select-window curwin))))
    (when (and mouse-wheel-click-event mouse-wheel-inhibit-click-time)
      (if mwheel-inhibit-click-event-timer
        (cancel-timer mwheel-inhibit-click-event-timer)
--- 230,240 ----
                     ;; Make sure we do indeed scroll to the end of the buffer.
                     (end-of-buffer (while t (scroll-up)))))
                (t (error "Bad binding in mwheel-scroll"))))
!       (if curwin (select-window curwin)))
!     (when opoint
!       (with-current-buffer buffer
!       (when (/= opoint (point))
!         (deactivate-mark)))))
    (when (and mouse-wheel-click-event mouse-wheel-inhibit-click-time)
      (if mwheel-inhibit-click-event-timer
        (cancel-timer mwheel-inhibit-click-event-timer)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]