emacs-devel
[Top][All Lists]
Advanced

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

Re: mouse-face and help echo support for xterm mouse


From: Stefan Monnier
Subject: Re: mouse-face and help echo support for xterm mouse
Date: Wed, 04 Nov 2020 10:56:55 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>> In the patch below I slightly tweaked the code
> What patch?

Hmm... *the* patch, of course.


        Stefan


diff --git a/src/term.c b/src/term.c
index ff1aabfed2..a03a246415 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2562,7 +2562,8 @@
   ie.kind = NO_EVENT;
   ie.arg = Qnil;
 
-  if (event->type & (GPM_MOVE | GPM_DRAG)) {
+  if (event->type & (GPM_MOVE | GPM_DRAG))
+    {
     previous_help_echo_string = help_echo_string;
     help_echo_string = Qnil;
 
@@ -2577,29 +2578,45 @@
        || !NILP (previous_help_echo_string))
       do_help = 1;
 
-    goto done;
+      eassert (ie.kind == NO_EVENT);
   }
-  else {
+  else
+    {
     f->mouse_moved = 0;
+      eassert (ie.kind == NO_EVENT);
     term_mouse_click (&ie, event, f);
+      eassert (ie.kind == GPM_CLICK_EVENT);
     if (tty_handle_tab_bar_click (f, event->x, event->y,
                                  (ie.modifiers & down_modifier) != 0, &ie))
       {
+          eassert (ie.kind == GPM_CLICK_EVENT
+                   || ie.kind == TAB_BAR_EVENT);
        /* tty_handle_tab_bar_click stores 2 events in the event
           queue, so we are done here.  */
+          /* FIXME: Actually, `tty_handle_tab_bar_click` returns true
+             without storing any events, when
+             (ie.modifiers & down_modifier) != 0  */
        count += 2;
        return count;
       }
+      eassert (ie.kind == GPM_CLICK_EVENT);
   }
 
- done:
-  if (ie.kind != NO_EVENT)
+  if (ie.kind != NO_EVENT) /* FIXME: We retest the previous if's condition!  */
     {
+      /* FIXME: `hold_quit` could already hold a previous event,
+         so it risks crushing that previous event.
+         What am I missing?  */
       kbd_buffer_store_event_hold (&ie, hold_quit);
       count++;
     }
 
   if (do_help
+      /* FIXME: `hold_quit` is never NULL?!  */
+      /* FIXME: Why do we test `hold_quit->kind != NO_EVENT` here?
+         This either comes from `ie` (via kbd_buffer_store_event_hold above)
+         or from an earlier call to us (tty_read_avail_input calls us in a
+         loop with the same `hold_quit` struct).  */
       && !(hold_quit && hold_quit->kind != NO_EVENT))
     {
       Lisp_Object frame;




reply via email to

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