diff options
Diffstat (limited to 'lisp/mouse.el')
-rw-r--r-- | lisp/mouse.el | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el index 94d19d99a21..5577b94d01a 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -433,9 +433,8 @@ MODE-LINE-P non-nil means dragging a mode line; nil means a header line." ;; - there is a scroll-bar-movement event ;; (same as mouse movement for our purposes) ;; quit if - ;; - there is a keyboard event or some other unknown event - ;; unknown event. - (cond ((integerp event) + ;; - there is a keyboard event or some other unknown event. + (cond ((not (consp event)) (setq done t)) ((memq (car event) '(switch-frame select-window)) @@ -443,7 +442,11 @@ MODE-LINE-P non-nil means dragging a mode line; nil means a header line." ((not (memq (car event) '(mouse-movement scroll-bar-movement))) (when (consp event) - (push event unread-command-events)) + ;; Do not unread a drag-mouse-1 event since it will cause the + ;; selection of the window above when dragging the modeline + ;; above the selected window. + (unless (eq (car event) 'drag-mouse-1) + (push event unread-command-events))) (setq done t)) ((not (eq (car mouse) start-event-frame)) @@ -498,7 +501,10 @@ MODE-LINE-P non-nil means dragging a mode line; nil means a header line." (and (not should-enlarge-minibuffer) (> growth 0) mode-line-p - (/= top (nth 1 (window-edges))))) + (/= top + (nth 1 (window-edges + ;; Choose right window. + start-event-window))))) (set-window-configuration wconfig))))))))) (defun mouse-drag-mode-line (start-event) @@ -1007,6 +1013,11 @@ should only be used by mouse-drag-region." (overlay-start mouse-drag-overlay)) region-termination)) last-command this-command) + (when (eq transient-mark-mode 'identity) + ;; Reset `transient-mark-mode' to avoid expanding the region + ;; while scrolling (compare thread on "Erroneous selection + ;; extension ..." on bug-gnu-emacs from 2007-06-10). + (setq transient-mark-mode nil)) (push-mark region-commencement t t) (goto-char region-termination) (if (not do-mouse-drag-region-post-process) |