all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Alan Mackenzie <acm@muc.de>, Eli Zaretskii <eliz@gnu.org>
Cc: 48409@debbugs.gnu.org, juri@linkov.net
Subject: bug#48409: Text runs away before user can copy it
Date: Thu, 20 May 2021 18:54:45 +0200	[thread overview]
Message-ID: <fcc3eb33-dfb2-5bf7-01b1-b40c92710dee@gmx.at> (raw)
In-Reply-To: <a2c0c6e9-dad8-12a9-ab3a-87475d7354a2@gmx.at>

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

 > For clicks into the bottom line the attached might help.  Clicks above
 > must be caught elsewhere.  But you don't get a drag event and no error
 > message for them.

The attached patch should allow clicking anywhere in the minibuffer
window.  Its more than kludgy but this is a bug that has annoyed me
for years.

martin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: keyboard.c.diff --]
[-- Type: text/x-patch; name="keyboard.c.diff", Size: 2385 bytes --]

diff --git a/src/keyboard.c b/src/keyboard.c
index 47b5e59024..92f842f2d7 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -5625,11 +5625,12 @@ make_lispy_event (struct input_event *event)
 	start_pos = *start_pos_ptr;
 	*start_pos_ptr = Qnil;

+	struct frame *f;
+
 	{
 	  /* On window-system frames, use the value of
 	     double-click-fuzz as is.  On other frames, interpret it
 	     as a multiple of 1/8 characters.  */
-	  struct frame *f;
 	  intmax_t fuzz;

 	  if (WINDOWP (event->frame_or_window))
@@ -5727,9 +5728,48 @@ make_lispy_event (struct input_event *event)
 			  it's probably OK to ignore it as well.  */
 		       && EQ (Fcar (Fcdr (start_pos)), Fcar (Fcdr (position)))))
 		  {
-		    /* Mouse has moved enough.  */
-		    button_down_time = 0;
-		    click_or_drag_modifier = drag_modifier;
+		    Lisp_Object start_window = XCAR (start_pos);
+		    Lisp_Object pos_window = XCAR (position);
+
+		    /* For the minibuffer window special precautions are
+		       needed because it may change its height in between
+		       two clicks.  */
+		    if (WINDOW_LIVE_P (pos_window)
+			&& WINDOW_LIVE_P (start_window)
+			&& MINI_WINDOW_P (XWINDOW (start_window)))
+		      {
+			struct window *start_w = XWINDOW (start_window);
+			struct window *pos_w = XWINDOW (pos_window);
+
+			if (start_w == pos_w
+			    && WINDOW_PIXEL_HEIGHT (pos_w) >= XFIXNUM (XCDR (down))
+			    && WINDOW_PIXEL_WIDTH (pos_w) >= XFIXNUM (XCAR (down)))
+			  /* Mouse has moved enough.  */
+			  {
+			    button_down_time = 0;
+			    click_or_drag_modifier = drag_modifier;
+			  }
+			else if (start_w != pos_w
+				 && (WINDOW_PIXEL_HEIGHT (start_w) >= XFIXNUM (XCDR (down))
+				     || WINDOW_PIXEL_WIDTH (start_w) >= XFIXNUM (XCDR (down))))
+			  /* Artificially move mouse into the minibuffer
+			     window's new text area.  */
+			  position
+			    = make_lispy_position (f,
+						   make_fixnum (WINDOW_BOX_LEFT_EDGE_X (start_w)
+								+ WINDOW_LEFT_FRINGE_WIDTH (start_w)
+								+ WINDOW_LEFT_MARGIN_WIDTH (start_w)
+								+ 1),
+						   make_fixnum (WINDOW_TOP_EDGE_Y (start_w) + 1),
+						   event->timestamp);
+		      }
+		    else
+		      /* Mouse has moved enough.  */
+		      {
+			button_down_time = 0;
+			click_or_drag_modifier = drag_modifier;
+		      }
+
 		  }
 	      }


  reply	other threads:[~2021-05-20 16:54 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-14  6:32 bug#48409: Text runs away before user can copy it 積丹尼 Dan Jacobson
2021-05-14  7:07 ` Eli Zaretskii
2021-05-14 17:58   ` Juri Linkov
2021-05-14 18:46     ` Eli Zaretskii
2021-05-15 12:29       ` 積丹尼 Dan Jacobson
2021-05-15 12:34         ` Eli Zaretskii
2021-05-14 19:45     ` Eli Zaretskii
2021-05-14 19:51       ` bug#48409: [External] : " Drew Adams
2021-05-14 20:13       ` Eli Zaretskii
2021-05-14 20:53         ` Alan Mackenzie
2021-05-15  5:56           ` Eli Zaretskii
2021-05-15 11:15             ` Alan Mackenzie
2021-05-17 20:53       ` Juri Linkov
2021-05-18 13:13         ` Eli Zaretskii
2021-05-18 18:42           ` Alan Mackenzie
2021-05-18 19:05             ` Eli Zaretskii
2021-05-18 20:23               ` Alan Mackenzie
2021-05-19 12:12                 ` Eli Zaretskii
2021-05-19 15:49                   ` Alan Mackenzie
2021-05-19 17:40                 ` martin rudalics
2021-05-20 16:54                   ` martin rudalics [this message]
2021-05-21 20:55                     ` Alan Mackenzie
2021-05-22  8:05                       ` martin rudalics
2021-05-22 11:42                         ` Alan Mackenzie
2021-05-22 14:36                           ` martin rudalics
2021-05-22 15:12                             ` Eli Zaretskii
2021-05-22 16:36                               ` martin rudalics
2021-05-30 15:44                           ` Alan Mackenzie
2021-05-31  7:55                             ` martin rudalics
2021-05-31 10:44       ` Alan Mackenzie

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

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

  git send-email \
    --in-reply-to=fcc3eb33-dfb2-5bf7-01b1-b40c92710dee@gmx.at \
    --to=rudalics@gmx.at \
    --cc=48409@debbugs.gnu.org \
    --cc=acm@muc.de \
    --cc=eliz@gnu.org \
    --cc=juri@linkov.net \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.