emacs-bug-tracker
[Top][All Lists]
Advanced

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

[debbugs-tracker] bug#29104: closed ([PATCH]: xterm-mouse-mode clicks in


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#29104: closed ([PATCH]: xterm-mouse-mode clicks in the modeline dont use the keymap properties of the modeline strings)
Date: Sun, 19 Nov 2017 04:26:02 +0000

Your message dated Sat, 18 Nov 2017 23:24:49 -0500
with message-id <address@hidden>
and subject line Re: bug#29104: AW: bug#29104: [PATCH]: xterm-mouse-mode clicks 
in the modeline dont use the keymap properties of the modeline strings
has caused the debbugs.gnu.org bug report #29104,
regarding [PATCH]: xterm-mouse-mode clicks in the modeline dont use the keymap 
properties of the modeline strings
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
29104: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=29104
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: [PATCH]: xterm-mouse-mode clicks in the modeline dont use the keymap properties of the modeline strings Date: Wed, 01 Nov 2017 14:45:32 +0100
1. emacs -Q -nw
2. M-x xterm-mouse-mode RET
3. mouse-1 click on the `*scratch*' string of the modeline.
4. Nothing happens. Expected behaviour would be, to change to the next buffer 
`*Messages*'.

This seems to be a bug in `keyboard.c:read_key_sequence'. After reading
the first characters of the xterm click event, they are remapped with
`keyremap_step' at line 9605 using the `input-decode-map'. The result of
this is a mouse-1 event structure, which carries the correct click
position. Unfortunately, this position isn't used, but instead, at line
9035, the position of the variable `first_event' is used.

The following patch sets `first_event' (after a key translation /
remapping) to the remapped event.

diff --git a/src/keyboard.c b/src/keyboard.c
index ee353d2b07..acb9c6be95 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -9607,6 +9607,8 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, 
Lisp_Object prompt,
          if (done)
            {
              mock_input = diff + max (t, mock_input);
+              first_event = mock_input > 0 ? keybuf[0] : Qnil;
+
              goto replay_sequence;
            }
        }
@@ -9647,6 +9649,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, 
Lisp_Object prompt,
                /* Adjust the input-decode-map counters.  */
                indec.end += diff;
                indec.start += diff;
+                first_event = mock_input > 0 ? keybuf[0] : Qnil;
 
                goto replay_sequence;
              }
@@ -9669,6 +9672,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, 
Lisp_Object prompt,
              indec.start += diff;
              fkey.end += diff;
              fkey.start += diff;
+              first_event = mock_input > 0 ? keybuf[0] : Qnil;
 
              goto replay_sequence;
            }


-- 
Olaf Rogalsky
Schwörhausgasse 5
89073 Ulm
Germany



--- End Message ---
--- Begin Message --- Subject: Re: bug#29104: AW: bug#29104: [PATCH]: xterm-mouse-mode clicks in the modeline dont use the keymap properties of the modeline strings Date: Sat, 18 Nov 2017 23:24:49 -0500 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
> In a more radical approach and instead of my original patch, one can
> get rid off with the variable first_event all together, see patch
> below. It simplifies the code a little bit, but of course is
> more risky.

Indeed, I got a similar patch (see below) by simply moving your
assignment to first_event from "before the `goto replay_sequence`" to
after it (i.e. after the replay_sequence label).

Your patch looks about as good as mine.  I think they're both better
than your first patch because they fix the problem in a single place
(The Right Place).

I installed mine because it's shorter and looks more "obviously safe"
to me.  Thanks a lot for tracking it down!


        Stefan


diff --git a/src/keyboard.c b/src/keyboard.c
index 399149ae97..6b7a6bfa74 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -8919,7 +8919,6 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, 
Lisp_Object prompt,
   ptrdiff_t keys_start;
 
   Lisp_Object current_binding = Qnil;
-  Lisp_Object first_event = Qnil;
 
   /* Index of the first key that has no binding.
      It is useless to try fkey.start larger than that.  */
@@ -9029,6 +9028,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, 
Lisp_Object prompt,
 
   starting_buffer = current_buffer;
   first_unbound = bufsize + 1;
+  Lisp_Object first_event = mock_input > 0 ? keybuf[0] : Qnil;
 
   /* Build our list of keymaps.
      If we recognize a function key and replace its escape sequence in


--- End Message ---

reply via email to

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