unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: occitan@esperanto.org
Cc: 12419@debbugs.gnu.org
Subject: bug#12419: Mouse click changes layout
Date: Sun, 16 Sep 2012 19:45:42 +0200	[thread overview]
Message-ID: <50561046.60902@gmx.at> (raw)
In-Reply-To: <5055D769.1060804@t-online.de>

[-- Attachment #1: Type: text/plain, Size: 1327 bytes --]

 > Ahem, not so sure what you'd want here.  But playing with your
 >
 >  >   emacs -Q
 >  >   (message (make-string 1000 ?a))
 >  >   C-x C-e
 >
 > example, which btw. give me only 8 lines, whit the initial quote out of
 > sight, you can easily reproduce this:
 >
 > Split *scratch* horizontally

... vertically (the new window is below the old one) ...

 > and then click on the 1 of 1000.

... in the new, lower window.

 > The
 > minibuffer shrinks, the 1 is blinking, but the mouse is no over the n of
 > notes, which slid down.  When letting go, the n blinks and all up to
 > before 1000 is marked.

I can see that.

 > Independently of resizing, something similar happens for sideways
 > scrolling:  Split *scratch* vertically, click on the v of visit,

What is the "v of visit"?

 > nothing
 > happens (that's where it dffers).  But then move the mouse 1 char right,
 > this triggers a sideways scroll.  The mouse is now over the e of file.
 > When letting go, it marks "visit that fil" but worse, it scrolls yet
 > again by the same amount, so that the mouse is now at the end of the
 > line, far from the text it marked.
 >
 > I'd expect both cases to consistently do something only when I release
 > the mouse, or when I drag to outside the window to force scrolling.

Can you try the attached patch?

Thanks, martin

[-- Attachment #2: resize-root-window-vertically.diff --]
[-- Type: text/plain, Size: 2560 bytes --]

=== modified file 'lisp/window.el'
--- lisp/window.el	2012-09-16 04:52:38 +0000
+++ lisp/window.el	2012-09-16 17:38:02 +0000
@@ -2394,27 +2394,32 @@
 This function is only called by the minibuffer window resizing
 routines.  It resizes windows proportionally and never deletes
 any windows."
-  (when (numberp delta)
-    (let (ignore)
-      (cond
-       ((< delta 0)
-	(setq delta (window-sizable window delta)))
-       ((> delta 0)
-	(unless (window-sizable window delta)
-	  (setq ignore t))))
-
-      (window--resize-reset (window-frame window))
-      ;; Ideally, we would resize just the last window in a combination
-      ;; but that's not feasible for the following reason: If we grow
-      ;; the minibuffer window and the last window cannot be shrunk any
-      ;; more, we shrink another window instead.  But if we then shrink
-      ;; the minibuffer window again, the last window might get enlarged
-      ;; and the state after shrinking is not the state before growing.
-      ;; So, in practice, we'd need a history variable to record how to
-      ;; proceed.  But I'm not sure how such a variable could work with
-      ;; repeated minibuffer window growing steps.
-      (window--resize-this-window window delta nil ignore t)
-      delta)))
+  (let (ignore)
+    (cond
+     ((not (numberp delta))
+      (setq delta 0))
+     ((zerop delta))
+     ((< delta 0)
+      (setq delta (window-sizable window delta))
+      (window--resize-reset (window-frame window))
+      ;; When shrinking the root window, emulate an edge drag in order
+      ;; to not resize other windows if we can avoid it (Bug#12419).
+      (window--resize-this-window
+       window delta nil ignore t 'before
+       (+ (window-top-line window) (window-total-size window)))
+      ;; Don't record new normal sizes to make sure that shrinking back
+      ;; proportionally works as intended.
+      (walk-window-tree
+       (lambda (window) (set-window-new-normal window 'ignore))))
+     ((> delta 0)
+      (window--resize-reset (window-frame window))
+      (unless (window-sizable window delta)
+	(setq ignore t))
+      ;; When growing the root window, resize proportionally.  This
+      ;; should give windows back their original sizes (hopefully).
+      (window--resize-this-window window delta nil ignore t)))
+     ;; Return the possibly adjusted DELTA.
+     delta))
 
 (defun adjust-window-trailing-edge (window delta &optional horizontal)
   "Move WINDOW's bottom edge by DELTA lines.



  parent reply	other threads:[~2012-09-16 17:45 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-11 22:04 bug#12419: Mouse click changes layout Daniel Pfeiffer
2012-09-12  2:59 ` Eli Zaretskii
2012-09-12  8:09 ` martin rudalics
2012-09-13 20:41   ` Daniel Pfeiffer
2012-09-14  9:00     ` martin rudalics
2012-09-14 10:36       ` Eli Zaretskii
2012-09-14 13:38         ` martin rudalics
2012-09-14 14:10           ` Drew Adams
2012-09-14 15:08             ` martin rudalics
2012-09-14 16:18               ` Drew Adams
2012-09-14 19:14                 ` martin rudalics
2012-09-14 19:40                   ` Drew Adams
2012-09-15  9:51                     ` martin rudalics
2012-09-15 10:31                       ` martin rudalics
2012-09-14 14:53           ` Eli Zaretskii
2012-09-14 15:16             ` martin rudalics
2012-09-14 16:20               ` Drew Adams
2012-09-14 19:14                 ` martin rudalics
2012-09-14 16:56               ` Eli Zaretskii
2012-09-14 19:15                 ` martin rudalics
2012-09-14 20:16                   ` Eli Zaretskii
2012-09-15  9:54                     ` martin rudalics
2012-09-15 10:23                       ` Eli Zaretskii
2012-09-15 10:39                         ` martin rudalics
2012-09-15 11:14                           ` Eli Zaretskii
2012-09-15 12:44                             ` martin rudalics
2012-09-15 13:35                               ` Eli Zaretskii
2012-09-15 14:34                                 ` martin rudalics
2012-09-14 15:45             ` Stefan Monnier
2012-09-14 19:14               ` martin rudalics
2012-09-14 19:56                 ` Stefan Monnier
2012-09-15  9:51                   ` martin rudalics
     [not found]       ` <5055D769.1060804@t-online.de>
2012-09-16 17:45         ` martin rudalics [this message]
2012-09-22 20:29           ` Daniel Pfeiffer
2012-09-23  9:21             ` martin rudalics
2012-09-23 21:56               ` Daniel Pfeiffer
2012-09-24  8:17                 ` martin rudalics
2012-09-24 14:33                   ` Eli Zaretskii
2012-09-25  9:58                     ` martin rudalics
2012-09-25 12:09                       ` Eli Zaretskii
2012-09-25 14:12                         ` martin rudalics
2012-09-26  8:22                           ` Eli Zaretskii
2012-09-26 11:03                             ` martin rudalics
2012-09-26 11:55                               ` Eli Zaretskii
2012-09-26 12:43                                 ` martin rudalics
2012-09-26 13:17                                   ` Eli Zaretskii
2012-09-26 13:44                                     ` martin rudalics
2012-09-26 13:57                                       ` Eli Zaretskii
2012-09-24 22:20                   ` Daniel Pfeiffer
2012-09-25  6:32                     ` Eli Zaretskii
2012-09-25  9:58                     ` martin rudalics
2020-09-13 17:06               ` Lars Ingebrigtsen
2020-12-07 16:43                 ` Lars Ingebrigtsen

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=50561046.60902@gmx.at \
    --to=rudalics@gmx.at \
    --cc=12419@debbugs.gnu.org \
    --cc=occitan@esperanto.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).