Commit Graph

193 Commits

Author SHA1 Message Date
Kovid Goyal
0f193141af Add support for OSC 777 based desktop notifications
Might as well, since we also support OSC 9, so why not yet another
poorly designed legacy scheme.
2021-10-25 10:46:00 +05:30
Kovid Goyal
d6a43a7729 Dont turn on disambiguate keys when receiving th XTMODKEYS escape code
See #4075
2021-10-01 21:26:27 +05:30
Kovid Goyal
2304d0ec5c Ignore extra zero in escape code to manipulate window title stack
See https://github.com/weechat/weechat/issues/1702
2021-09-30 09:16:51 +05:30
Kovid Goyal
aa9855516f Change memory allocation strategy for pending buf
Now it is allocated on demand. This prevents it from blowing up
to READ_BUF_SZ * 2 (2MB) if a small pending update is followed by a
large non pending section in the read buffer, which is commonly
triggered for instance by the transfer kitten which uses pending updates
for its screen drawing mixed with non-pending data transmission.

This is a slight performance penalty since there is a branch when
writing every char to the pending buffer, but the branch will be almost
always one sided so should be well predicted.

In any case, filling the pending buffer is not a performance bottleneck,
compared to actually dispatching parsed escape codes.
2021-09-16 20:23:15 +05:30
Kovid Goyal
e12246983b Fix the upper limit for the pending buffer
The pending buffer needs to be twice the max size of the read buffer.
2021-09-16 19:53:55 +05:30
Kovid Goyal
2a8fd278c1 Bring implementation of XTSAVE and XTRESTORE into line with xterm
Now a stack of depth 1 is used to save/restore private mode values. And
saving/restoring individual modes is supported. This latter is used by
midnight commander.
2021-09-14 21:59:41 +05:30
Kovid Goyal
8aacf30f19 Centralize definition of file transfer OSC code 2021-09-08 13:43:59 +05:30
Kovid Goyal
37735b962e Start work on new file_transmission protocol 2021-08-19 09:23:01 +05:30
Kovid Goyal
46b9aca16e Start work on shell integration 2021-08-18 10:06:04 +05:30
Kovid Goyal
be34af4555 Remove inline from .c files
It is ignored by compilers and hides unused static functions
2021-08-03 09:11:17 +05:30
Kovid Goyal
8f214c51c0 Get rid of kitty's special OSC 52 protocol
A better solution from an ecosystem perspective is to just work with the
original protocol. I have modified kitty's escape parser to special case
OSC 52 handling without changing its max escape code size.

Basically, it works by splitting up OSC 52 escape codes longer than the
max size into a series of partial OSC 52 escape codes. These get
dispatched to the UI layer where it accumulates them upto the 8MB limit
and then sends to clipboard when the partial sequence ends.

See https://github.com/ranger/ranger/issues/1861
2021-07-23 22:18:02 +05:30
Kovid Goyal
1ef895e246 When dumping commands dump stop_pending_mode at the correct place 2021-07-03 12:07:46 +05:30
Kovid Goyal
38ae370202 Fix #3789 2021-07-03 10:12:44 +05:30
Kovid Goyal
610a09817f Fix incorrect Sync terminfo entry 2021-07-03 09:18:33 +05:30
Kovid Goyal
026d200add Fix a bug in the implementation of the synchronized updates escape code that could cause incorrect parsing if either the pending buffer capacity or the pending timeout were exceeded
Fixes #3779
2021-07-01 15:32:53 +05:30
Kovid Goyal
e6a17f78b6 Use the main VT parser in pending mode as well
Should get much closer semantics in the two cases and its nice not to
have an extra mini VT parser for pending mode. There is a performance
hit in pending mode, since now the pending mode bytes are round tripped
via utf-8 decoding/encoding, but its worth it for the code
simplification.
2021-06-30 10:52:22 +05:30
Kovid Goyal
d6b6d3f59f Make dispatch_unicode_char re-useable 2021-06-30 08:29:40 +05:30
Kovid Goyal
5932ddb0fe DRYer 2021-06-30 07:57:21 +05:30
Kovid Goyal
3d5d60bc5b ... 2021-06-29 16:37:29 +05:30
Kovid Goyal
5c5599592a abort CSI parsing on NUL or DEL 2021-06-29 12:37:34 +05:30
Kovid Goyal
5768c54c5b Add support for pending mode via SM/RM 2026
Because, why the hell not, it's not like I have an actual life.
More seriously, terminal-wg (aka Bikeshedder's Anonymous) is
pushing for it so it's likely at least one poor application writer
will fall for their propaganda.
2021-06-29 12:24:34 +05:30
Kovid Goyal
057084a708 Add support for XTVERSION version reporting escape code 2021-06-14 10:20:50 +05:30
Kovid Goyal
4d0d0b205d Improve parser error messages a bit 2021-05-17 21:29:54 +05:30
Kovid Goyal
abb05f4883 ... 2021-05-10 07:16:43 +05:30
Kovid Goyal
053c2ed2b9 Make pow10_array const 2021-05-10 07:16:43 +05:30
Kovid Goyal
b32c346eed A new protocol extension to unscroll the screen
See https://gitlab.freedesktop.org/terminal-wg/specifications/-/issues/30
2021-04-23 15:44:38 +05:30
Kovid Goyal
b16317e2ca Silence spurious compiler warning 2021-04-19 13:27:17 +05:30
Kovid Goyal
6179cfc670 Abort parsing of APC and PM escape codes on 0x00 and 0x7f
Correct as per ECMA-48 section 8.3 and matches parsing of other escape
codes
2021-04-15 12:57:58 +05:30
Kovid Goyal
d360d077d1 Handle the XTMODKEYS escape code
Treat the XTerm specific modifyOtherKeys escape codes as putting the
disambiguate mode on/off the stack. The escape code causes XTerm to use
a (broken, naturally) variant of CSI u encoding for many keys, so we
treat it as going into the disambiguate mode.
2021-03-16 17:46:11 +05:30
Kovid Goyal
ac2a33d09f Silence the errors about OSC 7
Up to now this poorly designed and completely unnecessary escape code
was relegated to only GNOME, however, off late Apple has started using
it as well, so silently ignore it, instead of spamming error messages
for it.
2021-01-29 12:43:41 +05:30
Kovid Goyal
2ee1a366fd Also assert non-negative params for SET_MODE 2021-01-21 07:21:23 +05:30
Kovid Goyal
f9844ba3b0 Allow negative numbers in CSI codes 2021-01-21 07:06:43 +05:30
Kovid Goyal
7cea233de3 - is not a CSI start modifier 2021-01-21 06:44:18 +05:30
Kovid Goyal
e4d8aac3d5 Make CSI parsing a bit more spec compliant
Now the full list of secondary characters (intermediate bytes) is used from ECMA 48
Also the codes that accept only one parameter now report errors when
multiple parameters are passed.
2021-01-21 06:41:27 +05:30
Kovid Goyal
a30ea2b7f8 Implement progressive enhancement of key event reporting 2021-01-16 20:52:12 +05:30
Kovid Goyal
b3ed4c3f40 Simplify implementation of REP
Also make it align more with the standard by using the actual last drawn
graphics character rather than the character before the cursor
2021-01-03 04:38:02 +05:30
Kovid Goyal
5f8dee8384 Add support for the color settings stack that XTerm copied from us without acknowledgement and decided to use incompatible escape codes for.
Completely in keeping with that project's past behavior.
See https://github.com/kovidgoyal/kitty/issues/879

XTerm announcement:
https://www.mail-archive.com/xorg@lists.x.org/msg06419.html
2020-12-21 21:39:05 +05:30
Kovid Goyal
e97f1a4310 Have the save/restore colors escape codes also save restore the ANSI color table 2020-12-21 19:38:03 +05:30
Kovid Goyal
19870983ca Allow specifying text formatting in tab_title_template
Fixes #3146
2020-12-08 21:42:40 +05:30
Kovid Goyal
33beecddda Implement storage of URLs in a hash map 2020-09-10 10:47:27 +05:30
Kovid Goyal
e99d93ca30 Implement parsing of OSC 8
Also start work on storing hyperlinks with cells
2020-09-10 10:47:24 +05:30
Kovid Goyal
601d37aa3d Avoid malloc+copy for unknown OSC codes 2020-08-24 20:14:16 +05:30
Kovid Goyal
eca53bfab0 Add a new escape code to allow terminal programs to trigger desktop notifications
Fixes #1474
2020-08-21 20:29:54 +05:30
Kovid Goyal
a083aa04b2 vim also produces CSI > 4;m ignore that as well 2020-07-24 19:19:18 +05:30
Kovid Goyal
9f28dd61d3 Silence a spurious code scanning warning
I hope it silences it anyway
2020-07-07 09:31:00 +05:30
Kovid Goyal
025f6d7701 Add keypad mode support to replay commands
Also name the constants correctly
2020-06-29 12:46:34 +05:30
Kovid Goyal
d675977f10 Better error message for xterm specific key resource CSI codes that vim has started emitting 2020-06-25 23:07:34 +05:30
Kovid Goyal
7ef911e17d Fix #2798 2020-06-25 21:43:54 +05:30
Kovid Goyal
7525e152b8 Make comment a bit better 2020-06-15 06:55:52 +05:30
Kovid Goyal
bc9dfec615 Fix #2764 2020-06-15 06:53:35 +05:30