Commit Graph

166 Commits

Author SHA1 Message Date
nicm
31b6c9356c C-h should not be treated specially and represented internally as \b but
as C-h like the other Ctrl keys. Backspace is already handled separately
if it VERASE.
2024-08-26 07:45:05 +00:00
nicm
c7e61a01e5 Revamp extended keys support to more closely match xterm and support
mode 2 as well as mode 1. From Stanislav Kljuhhin (GitHub issue 4038).

This changes tmux to always request mode 2 from parent terminal, change
to an unambiguous internal representation of keys, and adds an option
(extended-keys-format) to control the format similar to the xterm(1)
formatOtherKeys resource.
2024-08-21 04:17:09 +00:00
nicm
937ba1d8dd Both terminators \007 and \033\\ leave the index pointing to the final
character of the terminator, so correct the size calculation to always
add one. GitHub issue 4082.
2024-08-19 08:29:16 +00:00
nicm
aa1353947e UTF-8 keys now contain the internal representation and not the Unicode
codepoint, so convert extended keys properly. From Stanislav Kljuhhin.
2024-07-12 11:21:18 +00:00
nicm
093b5a5518 Add a way (refresh-client -r) for control mode clients to provide OSC 10
and 11 responses to tmux so they can set the default foreground and
background colours, from George Nachman in GitHub issue 4014.
2024-06-24 08:30:50 +00:00
nicm
6f0254e6a8 Look for feature code 21 for DECSLRM and 28 for DECFRA in the device
attributes and also accept level 1 (there is no hardware with this but
some emulators may use it). Pointed out by James Holderness.
2024-03-21 11:47:55 +00:00
nicm
c02bc4dbe9 On second thoughts, do check DA2 for DECFRA and DECSLRM since that will
catch terminals that say they are VT520 even if we can't use DA1
(because of VTE).
2023-09-08 07:05:06 +00:00
nicm
4872811ba7 Use DECSLRM and DECFRA only at level 4 rather than checking the terminal
id.
2023-09-08 06:52:31 +00:00
nicm
9653a52a6a Use DECSLRM and DECFRA on terminals pretending to be VT520 or VT525 as
well as VT420.
2023-09-07 10:21:46 +00:00
nicm
c99f9e92e0 Accept 65 for VT525 as well. 2023-09-07 07:19:21 +00:00
nicm
c767d62329 Request terminal colours again on SIGWINCH but at most once every 30
seconds, GitHub issue 3582.
2023-09-02 20:03:10 +00:00
nicm
4e57894e85 Get rid of some warnings with GCC 10, from Thomas Klausner. 2023-06-30 13:19:32 +00:00
nicm
280fe77edd Discard mouse sequences that have the right form but actually are
invalid (for example have column zero rather than one).
2023-04-17 17:57:35 +00:00
nicm
b41892622d Fix behaviour with \007 (used the wrong tree for last change). 2023-01-09 14:12:41 +00:00
nicm
c0031f8b85 Accept \007 as terminator to OSC 10 or 11. 2023-01-09 07:57:14 +00:00
nicm
a41a927441 Query the client terminal for foreground and background colours and if
OSC 10 or 11 is received but no colour has been set inside tmux, return
the colour from the first attached client (probably most people will
have all light or or all dark terminals).
2023-01-03 11:43:24 +00:00
nicm
20da167377 Tweak previous to set and log the feature instead of just setting the
flag.
2022-11-11 08:44:11 +00:00
nicm
fe475bd856 Parse primary device attributes as well as secondary and add a SIXEL
flag (not used yet), from Anindya Mukherjee.
2022-11-11 08:37:55 +00:00
nicm
9614f51560 Instead of always setting the extended flag, set it only when searching.
Allows send-keys to work. From Aaron Jensen.
2022-11-02 07:36:07 +00:00
nicm
2d08235987 Add modified Tab key sequences, from Aaron Jensen, GitHub issue 3368. 2022-11-01 09:54:13 +00:00
nicm
86dfbda0e4 Process modifiers as bits rather than using a switch, from Koichi Murase. 2022-07-19 06:51:31 +00:00
nicm
616bde08ac kf* terminfo capabilities are poorly defined and rxvt uses them in a
different way from xterm, so add a feature flag for rxvt to make tmux
ignore the capabilities and instead rely on its builtin definitions.
2022-06-14 07:29:00 +00:00
nicm
201a8d8e7e If escape-time is 0, force to 1 instead - not waiting at all is asking
for problems on some platforms.
2022-06-01 15:43:22 +00:00
nicm
2b60ff588e If a mouse position was above the maximum supported by the normal mouse
protocol (223), tmux was allowing it to wrap around. However, since tmux
was not correctly handling this on input, other programs also do not
handle it correctly, and the alternative SGR mouse mode is now
widespread, this seems unnecessary, so remove this feature. Also define
some constants to make it clearer what the numbers mean. Mostly from
Leonid S Usov in GitHub issue 3165.
2022-05-30 13:02:55 +00:00
nicm
ad9b805983 Add argument to refresh-client -l to forward clipboard to a pane. GitHub
issue 3068.
2022-03-08 12:01:19 +00:00
nicm
0027ee13a0 Support more mouse buttons when the terminal sends them, GitHub issue
3055.
2022-02-16 18:55:05 +00:00
nicm
f85208602d Do not create a buffer from an OSC 52 response if we have not sent a
query.
2022-02-15 13:03:02 +00:00
nicm
289ac55ebd Correctly adjust the end pointer for a two character terminator before
decoding OSC 52 response, from Daniel Ekloef in GitHub issue 2942.
2021-10-21 08:36:51 +00:00
nicm
13a0da205b Break message type stuff out into its own header. 2021-08-13 07:37:58 +00:00
nicm
2bb0b9d6c5 Change focus to be driven by events rather than walking all panes at end
of event loop, this way the ordering of in and out can be enforced.
GitHub issue 2808.
2021-08-13 06:52:51 +00:00
nicm
19812b2d29 Add client focus hooks. 2021-08-06 09:19:02 +00:00
nicm
e5106bfb96 Add another couple of keys needed for extended keys, GitHub issue 2658.
Handle modifier 9 as Meta, GitHub issue 2647.
2021-06-10 07:21:09 +00:00
nicm
bbb3509bc5 Change how extended ctrl keys are processed to fix C-S-Tab and C-;. 2021-04-13 12:26:34 +00:00
nicm
715835510b Handle C-Tab correctly with extended keys, GitHub issue 2642. 2021-04-13 05:23:34 +00:00
nicm
efb5e58c38 Restore previous behaviour so that C-X remains the same as C-x. Instead,
translate incoming extended keys so that they are consistent.
2021-04-07 15:46:12 +00:00
nicm
ba99996676 Fixes for extended keys: 1) allow C-x and C-X to be bound separately
since some terminals report them differently 2) use the "backspace"
option to translate backspace 3) map ctrl which are have the ctrl
implied (such as C-x) properly when the terminal reports both the key
and the modifier.

Note that any key bindings for C-X where C-x is meant must now be
changed.
2021-04-07 07:30:02 +00:00
nicm
f2dfc2759e Escape+Up and the other arrow keys should be kept as Escape+Up and not
converted to M-Up. Do not give them the implied meta flag so they don't
match the M-Up entry in the output key tree. Fixes problem with vi
reported by jsing@.
2020-09-23 14:57:33 +00:00
nicm
e4a4fcfc90 Old Terminal.app versions do not respond correctly to secondary DA,
instead responding with the primary DA response. Ignore it. Reported by
Dave Vandervies.
2020-08-24 05:23:30 +00:00
nicm
2bf612a806 Always send xterm-style keys for M-Left and M-Right. GitHub issue 2296. 2020-07-06 07:27:39 +00:00
nicm
f3931497f8 Use CLOCK_MONOTONIC for timer measurement and add a timestamp to control
mode %output blocks.
2020-06-02 08:17:27 +00:00
nicm
6f03e49e68 Use the internal representation for UTF-8 keys instead of wchar_t and
drop some code only needed for that.
2020-05-25 18:57:24 +00:00
nicm
033d6472cb FocusIn keys can also update the latest client, like normal keys. 2020-05-22 15:43:38 +00:00
nicm
0ab82d9531 Add a terminal feature for enable/disable extended keys (supported by
xterm and mintty) and add an option to make tmux send it. Only forward
extended keys if the application has requested them, even though we use
the CSI u sequence and xterm uses CSI 27 ~ - this is what mintty does as
well.
2020-05-16 16:44:54 +00:00
nicm
469eda7e44 Only redraw popup on the client it belongs to. 2020-05-16 15:41:54 +00:00
nicm
26312a7774 Move terminal features into a single file. 2020-05-16 14:30:17 +00:00
nicm
41dec585df Response is iTerm2 not not ITerm2. 2020-05-16 14:18:39 +00:00
nicm
9dd58470e4 Remove support for iTerm2's DSR 1337 extension and use the CSI > q
extension now supported by a few different terminals.
2020-05-16 14:16:25 +00:00
nicm
2083a6ea20 Change how sync works to always send the end sequence after all output
is done when we are returning to the event loop (since we always move
the cursor at that point). Also a man fix from jmc.
2020-04-20 14:59:31 +00:00
nicm
c91b4b2e14 Tidy up the terminal detection and feature code and add named sets of
terminal features, each of which are defined in one place and map to a
builtin set of terminfo(5) capabilities. Features can be specified based
on TERM with a new terminal-features option or with the -T flag when
running tmux. tmux will also detect a few common terminals from the DA
and DSR responses.

This is intended to make it easier to configure tmux's use of
terminfo(5) even in the presence of outdated ncurses(3) or terminfo(5)
databases or for features which do not yet have a terminfo(5) entry.
Instead of having to grok terminfo(5) capability names and what they
should be set to in the terminal-overrides option, the user can
hopefully just give tmux a feature name and let it do the right thing.

The terminal-overrides option remains both for backwards compatibility
and to allow tweaks of individual capabilities.

tmux already did much of this already, this makes it tidier and simpler
to configure.
2020-04-20 13:25:36 +00:00
nicm
7f2925a01d Support the application escape sequence mintty (means tmux doesn't have
to delay to wait for Escape).
2020-04-17 09:06:10 +00:00