Repository navigation
Conversation
|
Hm, it seems to have been added to the terminfo database (and also to xterm), see e.g. here: https://github.com/ThomasDickey/xterm-snapshots/blob/4130ad43faa71d94ad1508d57d1c22237b09e012/terminfo#L972-L974 and here: https://invisible-island.net/xterm/xterm.log.html#xterm_224 and https://invisible-island.net/xterm/xterm-paste64.html (search for Bram) Perhaps @ThomasDickey wants to commen there (is it supported in xterm or what is the plan with it)? |
|
Bram asked for this in a conversation with me beginning January 12, 2023. I didn't make the change immediately, since it takes time to verify which terminal descriptions to modify. Certainly it is supported in xterm. Other terminal emulators may respond to the mode, and may (or may not) do this incorrectly. Well-known terminal emulators have their own terminal descriptions, making it unnecessary to piggy-back on my work in xterm. This may be related to a recent bug report dealing with VTE (see this). |
|
Thanks @chrisbra for the references!
This mentions:
@ThomasDickey Am I understanding this correctly that
These links discuss the addition of mode One line in here says:
This does seem to support including focus reporting mode in the To clarify my motivation here: I know of at least one instance where someone included |
|
No - XM (as you can see from the source-history) used to be defined without 1004. ncurses uses Since May 2023, xterm-256color uses 1004 (which is what we're discussing). It would be possible to "move" that 1004 to a new capability which only enables/disables the focus-event, except for a couple of problems:
|
I am not sure why you say it's only meaningful in conjunction with 1006/1000. Terminal applications can receive focus events independently of mouse events. Consider a keyboard driven window manager or tmux, both of which can focus a terminal window without ever moving the mouse. Even if one does use the mouse to focus a terminal (e.g. by clicking the operating system window), the focus event is sent by the windowing library and need not report any mouse events. In practice, there does seem to be a meaningful distinction. Vim, tmux, and Neovim (to name a few terminal applications I'm at least somewhat familiar with) all have the ability to enable focus events independent of mouse events.
Vim already uses
I cannot speak to that, as I don't have any experience using libvte or any of the terminal emulators which use it. But as I mentioned above, I do know that existing ncurses applications such as |
|
fe/fd appear to be ok (to use in a terminal description). |
|
so I guess we should keep it in the documentation? |
|
I'm still in favor of removing it. To recap the discussion:
|
|
See my change here: |
|
thanks all. How about this then: diff --git a/runtime/doc/term.txt b/runtime/doc/term.txt
index 72af6d3df..38e4f515a 100644
--- a/runtime/doc/term.txt
+++ b/runtime/doc/term.txt
@@ -332,11 +332,16 @@ using the "xterm" workaround. These are the relevant entries (so far):
XM "\033[?1006;1004;1000%?%p1%{1}%=%th%el%;"
mouse enable / disable |t_XM|
+ FE "\033[?1004h" enable focus event tracking |t_fe|
+ FD "\033[?1004l" disable focus event tracking |t_fd|
The "XM" entry includes "1006" to enable SGR style mouse reporting. This
supports columns above 223. It also includes "1004" which enables focus
-reporting. The t_fe and t_fd entries can be left empty (they don't have
-entries in terminfo/termcap anyway).
+reporting.
+Note: As of 2023, the "1004" is currently not used by Vim itself, instead
+it's recommended to set focus reporting independently of mouse tracking by
+the |t_fe| and |t_fd| entries, as ncurses also starts to use with the latest
+versions (and will then also end up in terminfo/termcap).
*xterm-kitty* *kitty-terminal*
The Kitty terminal is a special case. Mainly because it works differently |
|
looks fine (I would do "it is" rather than "it's"). |
I am not sure why Bram added this snippet to the docs. The commit where this was added has only the commit message "Update runtime files", and I couldn't find any GitHub PRs or anything in the vim_dev mailing list about this either.
Mode 1004 (focus reporting) is not actually used in the default
XMtermcap defined in Vim. Ncurses mentions only modes 1000 and 1006 in their documentation (here and here).Focus reporting does not have its own terminfo entry but does have its own Vim option (
t_feandt_fd) and correct default values. So adding mode 1004 toXMis not even necessary to enable focus events.This is a documentation only change, so it does not fix any actual bugs (in Vim, anyway. It does cause bugs in other programs). But Vim is often used as a reference for how to support various terminal features, so this will hopefully prevent people from copying Vim's documentation and adding mode 1004 to the XM capability.