[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Additional cleanup around xterm-mouse
From: |
Eli Zaretskii |
Subject: |
Re: Additional cleanup around xterm-mouse |
Date: |
Sat, 21 Nov 2020 11:31:04 +0200 |
> Date: Thu, 19 Nov 2020 00:03:30 -0800
> From: Jared Finder <jared@finder.org>
> Cc: emacs-devel@gnu.org
>
> > I don't think I follow. All the places where you need changes are
> > related to handling mouse events, so why cannot it be specific to
> > xt-mouse?
>
> There is a bug in widget-key-sequence-read-event's usage of keyboard
> events specifically.
>
> The function widget-key-sequence-read-event currently does not correctly
> translate function keys for the terminal. It has code that attempts to
> apply function-key-map, but does not apply input-decode-map, so it can
> not read function keys. (Additionally, it should be using
> local-function-key-map now.)
OK, but that means widget-key-sequence-read-event has a bug that needs
to be fixed regardless.
So I'm still asking why can't we do something like
(if xterm-mouse-mode
(read-key)
(read-event))
in all the affected places that currently call read-event?
> Changing to read-key fixes this as read-key goes through
> read-key-sequence which applies input-decode-map. However, to get the
> same intended functionality requires some new parameters, which I also
> add in my patch.
The problem is that we get lots of unintended functionalities even
with the new parameters. read-key-sequence consults many internal
variables that read-event doesn't. So I'm still wary of making such a
significant change, even though we are talking about a small number of
relatively minor feature (with the sole exception of Ediff, perhaps).
If the above less-elegant change which will only affect usage under
xterm-mouse-mode is feasible, I'd prefer to go that way instead.
> (let ((ev2 (and (memq 'down (event-modifiers ev))
> - (read-event)))
> - (tr (and (keymapp function-key-map)
> - (lookup-key function-key-map (vector ev)))))
> + (read-key)))
> + ;; This is actually a separate bug-fix. `function-key-map'
> + ;; does not contain any term-specific function key mappings
> + ;; like f13 --> S-f1.
> + (tr (and (keymapp local-function-key-map)
> + (lookup-key local-function-key-map (vector ev)))))
Let's fix this part separately.