aboutsummaryrefslogtreecommitdiff
path: root/osc.c (follow)
Commit message (Collapse)AuthorAgeLines
* osc: update font subpixel mode, and window opaque compositor hint, on alpha changesDaniel Eklöf2023-05-26-1/+8
| | | | | | | | | | | | | | | | | | | | | When background alpha is changed at runtime (using OSC-11), we (may) have to update the opaque hint we send to the compositor. We must also update the subpixel mode used when rendering font glyphs. Why? When the window is fully opaque, we use wl_surface_set_opaque_region() on the entire surface, to hint to the compositor that it doesn’t have to blend the window content with whatever is behind the window. Obviously, if alpha is changed from opaque, to transparent (or semi-transparent), that hint must be removed. Sub-pixel mode is harder to explain, but in short, we can’t do subpixel hinting with a (semi-)transparent background. Thus, similar to the opaque hint, subpixel antialiasing must be enabled/disabled when background alpha is changed.
* osc: add support for OSC 133;A (prompt markers)Daniel Eklöf2022-06-16-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for the OSC-133;A sequence, introduced by FinalTerm and implemented by iTerm2, Kitty and more. See https://iterm2.com/documentation-one-page.html#documentation-escape-codes.html. The shell emits the OSC just before printing the prompt. This lets the terminal know where, in the scrollback, there are prompts. We implement this using a simple boolean in the row struct ("this row has a prompt"). The prompt marker must be reflowed along with the text on window resizes. In an ideal world, erasing, or overwriting the cell where the OSC was emitted, would remove the prompt mark. Since we don't store this information in the cell struct, we can't do that. The best we can do is reset it in erase_line(). This works well enough in the "normal" screen, when used with a "normal" shell. It doesn't really work in fullscreen apps, on the alt screen. But that doesn't matter since we don't support jumping between prompts on the alt screen anyway. To be able to jump between prompts, two new key bindings have been added: prompt-prev and prompt-next, bound to ctrl+shift+z and ctrl+shift+x respectively. prompt-prev will jump to the previous, not currently visible, prompt, by moving the viewport, ensuring the prompt is at the top of the screen. prompt-next jumps to the next prompt, visible or not. Again, by moving the viewport to ensure the prompt is at the top of the screen. If we're at the bottom of the scrollback, the viewport is instead moved as far down as possible. Closes #30
* osc: avoid unnecessary calls to strlen(3)Craig Barnes2022-04-06-5/+5
| | | | | | | | | | | | | | | | | Checking for specific strings of length 0 or 1 can be done with e.g.: if (str[0] == '\0') {...} if (str[0] == '?' && str[1] == '\0') {...} Doing it this way instead of using strlen(3) means we avoid the function call overhead and also avoid scanning through more of the string than is neceessary. A compiler could perhaps optimize away calls to strlen(3) when the result is compared to a small constant, but GCC 11.2 only seems to actually do this[1] for lengths of 0. [1]: https://godbolt.org/z/qxoW8qqW6
* osc: use four digits in OSC-4 and OSC-11 rgb:r/g/b repliesDaniel Eklöf2022-03-13-4/+6
| | | | Closes #971
* osc: grow OSC buffer exponentially instead of by fixed increments of 128Craig Barnes2022-03-02-3/+13
| | | | | | With fixed increments of 128 bytes, an OSC 52 copy operation could end up doing thousands or tens of thousands of realloc(3) calls just to copy a few MB.
* osc: don’t damage the entire view on a single color palette updateDaniel Eklöf2022-02-10-1/+41
| | | | | Instead, loop the viewport and dirty only those cells that are affected by the palette change.
* osc: implement OSC-22 - set xcursor pointerDaniel Eklöf2022-02-07-0/+4
|
* csi: store color index, not actual color, in cell’s fg/bg attributesDaniel Eklöf2021-12-26-60/+4
| | | | | | | | | | | | | | | | | | When using indexed colors (i.e. SGR 30/40/90/100), store the index into the cell’s fg/bg attributes, not the actual color value. This has a couple of consequences: Color table lookup is now done when rendering. This means a rendered cell will always reflect the *current* color table, not the color table that was in use when the cell was printed to. This simplifies the OSC-4/104 logic, since we no longer need to update the grid - we just have to damage it to trigger rendering. Furthermore, this change simplifies the VT parsing, since we no longer need to do any memory loads (except loading the SGR parameter values), only writes.
* osc-4: don’t update the color of cells with RGB fg/bg colorsDaniel Eklöf2021-12-01-11/+11
| | | | | | | | | | | | | | | | | | | | OSC 4/104 changes the 256-color palette. We also run a pass over the visible cells, and update their colors. This was previously done by comparing the actual color of the cell, with the “old” color in the palette. If they matched, the cell was updated. This meant that cells with an RGB color (i.e. not a palette based color) was also updated, _if_ its color matched the palette color. Now that each cell tracks its color *source*, we can ignore all non-palette based cells. Note that this still isn’t perfect: if the palette contains multiple entries with the same color, we’ll end up updating the “wrong” cells. Closes #678
* term: track cell color sourceDaniel Eklöf2021-11-20-3/+3
| | | | | | | | | | | | | Each cell now tracks it’s current color source: * default fg/bg * base16 fg/bg (maps to *both* the regular and bright colors) * base256 fg/bg * RGB Note that we don’t have enough bits to separate the regular from the bright colors. These _shouldn’t_ be the same, so we ought to be fine...
* Merge branch 'parse-rgb-strlen'Daniel Eklöf2021-10-20-4/+3
|\
| * osc: use STRLEN() macro to make parse_rgb() more self-documentingCraig Barnes2021-10-20-4/+3
| | | | | | | | | | The empty literals in the macro are to ensure the argument itself is a string literal, so it can't be used on anything else.
* | osc: use BEL terminator in OSC replies to BEL-terminated OSC queriesCraig Barnes2021-10-20-6/+17
|/ | | | | | | | | This matches the documented (and observed) behavior in xterm: > XTerm accepts either BEL or ST for terminating OSC sequences, and > when returning information, uses the same terminator used in a query -- https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands
* osc: fix typo in LOG_DBG() messageCraig Barnes2021-07-24-1/+1
|
* osc: implement iTerm2’s OSC-9 - desktop notificationsDaniel Eklöf2021-06-04-1/+6
|
* osc: implement OSC 17+19: change selection background/foreground colorsDaniel Eklöf2021-04-08-3/+31
| | | | | And of course, we also implement the corresponding reset sequences, OSC 117+119.
* osc: reset background alpha when resetting the background colorDaniel Eklöf2021-04-08-0/+1
|
* osc: parse_legacy_color(): the alpha component is not a floating point numberDaniel Eklöf2021-04-08-8/+7
| | | | | | When using the urxvt extension of the XParseColor format, the alpha component is not a floating point number, but a decimal number in the range 0-100.
* osc: parse_rgb(): ensure ‘alpha’ has been initializedDaniel Eklöf2021-04-08-1/+1
|
* osc: add support for URxvt extension to include alpha in OSC-11Daniel Eklöf2021-04-08-24/+100
| | | | | | | There are two variants, either using a ‘[percent]’ prefix for legacy colors, or using ‘rgba:r/g/b/a’ instead of ‘rgb:r/g/b’. Closes #436
* config/terminal: refactor: remove “default_*” color members from terminal structDaniel Eklöf2021-04-07-8/+8
| | | | Access the original colors in the configuration instead.
* osc: verify OSC 4/104 color index is validDaniel Eklöf2021-04-05-1/+11
| | | | Closes #434
* osc-8: fix thinko: can’t use the ID parameters *address* as actual IDDaniel Eklöf2021-02-21-4/+4
| | | | | | | Doing so means the next OSC-8 URL emitted by the client application, with the same ID, will get a *new* id internally. Instead, hash the string and use that as ID.
* term: add ‘id’ parameter to term_osc8_open()Daniel Eklöf2021-02-21-1/+1
| | | | | The current OSC-8 URL’s ID is now tracked along with the URI itself, and its starting point.
* osc: 8: parse params, and the ‘id’ parameter specificallyDaniel Eklöf2021-02-21-1/+22
| | | | | | | | | | | | | | | | | | | Applications can assign an ID to the URL. This is used to associate the parts of a split up URL with each other: ╔═ file1 ════╗ ║ ╔═ file2 ═══╗ ║http://exa║Lorem ipsum║ ║le.com ║ dolor sit ║ ║ ║amet, conse║ ╚══════════║ctetur adip║ ╚═══════════╝ In the example above, ‘http://exa’ and ‘le.com’ are part of the same URL, but by necessity split up into two OSC-8 URLs. If the application sets the same ID for those two OSC-8 URLs, the terminal can ensure they are handled as one.
* osc: parse OSC-8, by calling term_osc8_{open,close} as appropriateDaniel Eklöf2021-02-21-0/+43
|
* debug: rename assert() to xassert(), to avoid clashing with <assert.h>Craig Barnes2021-01-16-11/+11
|
* Add xsnprintf() and remove some unnecessary strlen(3) callsCraig Barnes2021-01-14-6/+7
|
* notify: break out desktop notifications from osc.cDaniel Eklöf2020-12-10-91/+2
|
* osc: implement urxvt’s “OSC 777;notify”Daniel Eklöf2020-12-09-12/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | OSC 777 is URxvt’s generic escape to send commands to its perl extensions. The first parameter is the name of the extension, followed by its arguments. OSC 777;notify is a, if not well established, at least a fairly well known escape sequence to request a (desktop) notification. The syntax is: \e]777;notify;<title>;<body>\e\\ Neither title nor body is escaped in any way, meaning they should not contain a ‘;’. Foot will split title from body at the *first* ‘;’. Any remaining ‘;’ characters are treated as part of ‘body’. Instead of adding built-in support for the freedesktop notification specification (which would require us to link against at least dbus), add a new config option to foot.ini: ‘notify’. This option specifies the command to execute when a notification is received. ‘${title}’ and ‘${body}’ can be used anywhere, in any combination, and as many times as you want, in any of the command arguments. The default value is ‘notify-send -a foot -i foot ${title} ${body}’
* term: remove read-only properties copied from the configDaniel Eklöf2020-11-26-2/+3
| | | | Use the config directly instead.
* osc: use new uri_parse() to parse an OSC7 PWD URIDaniel Eklöf2020-10-28-75/+13
|
* osc: change info logging to debug logging when changing the cursor colorDaniel Eklöf2020-10-20-1/+1
|
* osc: don’t explicitly call render_refresh() when changing the color paletteDaniel Eklöf2020-09-29-9/+5
| | | | | | | | | | | | | | | | | | Doing so will schedule the renderer “as soon as possible”. I.e we’re by-passing the regular scheduler, and thus we’re by-passing the user’s setting of the delayed-render-* timers. The fact that we’re scheduling “as soon as possible” also means we’re much more likely to trigger flickering, or color flashes, if the application is changing colors which are on the screen. To handle changes to the cursor color(s), use the new term_damage_cursor() instead of render_refresh(). To handle background color changes, which affect the margins, use the new term_damage_margins() instead of render_refresh_margins(), Closes #141
* osc52: use first source that actually *has* dataDaniel Eklöf2020-09-09-20/+32
|
* osc52: unset (clear) selection when an invalid payload is receivedDaniel Eklöf2020-09-09-11/+16
|
* osc: explicitly refresh margins on a background color changeDaniel Eklöf2020-09-01-0/+2
|
* Don't use "case X ... Y:", if possible/where it makes senseDaniel Eklöf2020-08-23-3/+9
|
* osc: dirty grids on *all* color modifying sequencesDaniel Eklöf2020-08-18-47/+63
| | | | | | | We only updated the grid for OSC 4 - Set color <idx>. But we did *not* do it for 104 (reset color <idx>), 10 - set default foreground, 11 - set default background, 110 - reset default foreground, or 111 - reset default background.
* Fix some spelling mistakesCraig Barnes2020-08-15-1/+1
|
* Convert most dynamic allocations to use functions from xmalloc.hCraig Barnes2020-08-08-7/+12
|
* Replace non-portable "\e" escape in string literals with "\033"Craig Barnes2020-08-02-1/+1
|
* seat: use separate 'enter' serials for keyboard and mouseDaniel Eklöf2020-07-09-4/+3
|
* multi-seat: re-enable OSC 52 supportDaniel Eklöf2020-07-08-15/+38
|
* wip: multi-seat supportDaniel Eklöf2020-07-08-3/+10
| | | | | Compiles and runs, but mouse, clipboard and other things have been disabled.
* osc: set color: update both grids, but exclude scrollbackDaniel Eklöf2020-06-14-18/+22
|
* osc: 'Set Color' now updates already rendered cells in current gridDaniel Eklöf2020-06-11-1/+46
| | | | | | | | | | | | Since we don't have the original palette index in already rendered cells, we compare the color *value*. If it matches, we assume this was the color index used, and updates the cell's color. Note that for performance reasons, we only update the current grid. This is of course wrong, strictly speaking. However, it is expected that _Set Color_ is used by full-screen applications using the alternate grid.
* osc: don't assert on \E]4 being followed by a ';'Daniel Eklöf2020-06-09-0/+3
| | | | | This fixes a crash (in debug builds) that could be triggered by e.g. cat:ing /dev/urandom.
* osc: fix scaling of RGB formatted color specifiersDaniel Eklöf2020-05-02-3/+3
|
* osc: OSC 12: mimic xterm - a color value of 0 means use inverted fg/bgDaniel Eklöf2020-05-02-1/+4
|
* osc: fix 'OSC 12 ?' to return the cursor color, not the cursor text colorDaniel Eklöf2020-05-02-3/+3
|
* osc: fix scaling of legacy formatted color specifiersDaniel Eklöf2020-05-02-3/+3
|
* osc 104: handle multiple indices the same way we do in OSC 4 - use strtok()Daniel Eklöf2020-04-04-14/+13
|
* osc: 4: handle multiple idx;spec pairsDaniel Eklöf2020-04-04-33/+34
|
* osc: ignore OSC 7 when hostname doesn't match our own hostnameDaniel Eklöf2020-04-03-9/+28
|
* osc: implement OSC 12 and OSC 112 (set/reset text cursor color)Daniel Eklöf2020-01-20-0/+28
|
* osc: implement OSC 7 - set PWDDaniel Eklöf2019-12-21-0/+65
| | | | | | | | | OSC 7 updates the terminal's view of the current working directory. The format is OSC 7;URI ST We decode the URI and updates the term structs 'cwd' member. This is then used when spawning a new terminal instance.
* osc: spell "#if 0" correctlyDaniel Eklöf2019-12-19-1/+1
|
* osc: commented out beginning of OSC 777Daniel Eklöf2019-12-19-0/+23
| | | | I haven't decided if I want to support this
* csi/ocs/vt: log unhandled/unrecognized sequences as debug messagesDaniel Eklöf2019-11-29-1/+1
| | | | | | | | Having them as error messages was nice when we where still missing lots of sequences. Now we don't anymore, and these just spam stdout as well as syslog when e.g. cat:ing binary data.
* osc 52: default to 'clipboard' if no source/target has been specifiedDaniel Eklöf2019-11-28-12/+26
|
* osc: copy to/from clipboard: alias 's' to 'p'Daniel Eklöf2019-11-19-5/+4
| | | | | | 'p' means 'primary', while 's' means 'selection'. Thus, a client can now request 'selection' clipboard data and will receive it from the primary selection.
* selection: text_from_{clipboard,primary}: add 'done' callbackDaniel Eklöf2019-11-05-13/+22
| | | | | | | | This callback is *always* called, including when there has been an error. This is in preparation for making text_from_{clipboard,primary} asynchronous.
* Rename: vt_to_slave() -> term_to_slave()Daniel Eklöf2019-11-02-9/+9
|
* term: wayland struct is now not a part of the terminal structDaniel Eklöf2019-10-27-3/+3
| | | | | | We do however need access to it, so provide a pointer. The difference is that now we can have a *single* wayland instance, but multiple terminal instances.
* wayland: change all wayland callbacks to take a wayland pointerDaniel Eklöf2019-10-27-3/+3
| | | | | Instead of passing the terminal to the wayland callbacks, pass a 'struct wayland' pointer.
* osc: xparsecolor: parse 'legacy' colorsDaniel Eklöf2019-08-28-2/+46
|
* osc: add debug logs when colors are changed and resetDaniel Eklöf2019-08-21-1/+10
|
* term: rename colors256 -> tableDaniel Eklöf2019-08-21-5/+5
|
* term: use colors256 array for *all* colorsDaniel Eklöf2019-08-21-29/+5
| | | | | | That is, remove the 'regular' and 'bright' color arrays. This is possible since the 256-color array is defined such that the first 16 colors map to the regular and bright colors.
* osc: fix indexing into 'bright' color arrayDaniel Eklöf2019-08-21-3/+3
|
* osc: implement "change color" commandsDaniel Eklöf2019-08-21-39/+203
| | | | | | | | | | | This implements OSC 4, 10, 11 - change <color>/foreground/background, and their corresponding 'query' variant (which was already implemented for OSC 10/11). It also implements OSC 104, 110, 111 - reset <color>/foreground/background. Set corresponding terminfo entries to signal this support to clients.
* osc: implement copy/paste to/from primaryDaniel Eklöf2019-08-09-3/+8
|
* osc: bug: uneven clipboard bytes where not buffered correctlyDaniel Eklöf2019-08-03-2/+4
| | | | | | | | | | | | When responding to a OSC 52 clipboard request, we need to base64 encode the clipboard data. This is done in, potentially, several calls. Since we need at least 3 bytes to be able to produce any base64 output, we may have to buffer up to 2 bytes between the callback calls with clipboard data. This was being done incorrectly, where both bytes were written to index 0 in the buffer.
* osc: remove TODODaniel Eklöf2019-08-03-2/+0
|
* osc: reduce flash interval to 50msDaniel Eklöf2019-07-30-2/+1
|
* term: break out 'flash' to a separate 'term' functionDaniel Eklöf2019-07-30-13/+1
|
* vt: remove almost all abort() callsDaniel Eklöf2019-07-30-12/+8
| | | | | | Replace with generic error log messages that simply says the ESC/CSI/OSC sequence is unhandled. This can mean either invalid or unimplemented, depending on the context.
* osc: ignore OSC 30 (konsole's "set tab title")Daniel Eklöf2019-07-23-1/+7
|
* term: group 'flash' state together in a structDaniel Eklöf2019-07-22-2/+2
|
* flash: convert our own 'flash' from a CSI to an OSCDaniel Eklöf2019-07-22-0/+24
|
* term: track current window title in terminal structDaniel Eklöf2019-07-21-3/+3
|
* term: prepare for configurable colors; add color variables to terminalDaniel Eklöf2019-07-21-1/+1
|
* osc: add TODODaniel Eklöf2019-07-19-0/+2
|
* osc: delete empty lineDaniel Eklöf2019-07-19-1/+0
|
* osc: implement OSC 52;c;? - query clipboardDaniel Eklöf2019-07-19-38/+132
|
* osc: initial implementation of OSC 52 - copy to clipboardDaniel Eklöf2019-07-19-0/+64
|
* osc: foreground/background reply is now in correct XParseColor formatDaniel Eklöf2019-07-19-4/+13
| | | | | The format we used previously was a discouraged and obsolete format (and incorrect too).
* osc: allocate data buffer dynamicallyDaniel Eklöf2019-07-19-0/+20
|
* osc: terminate reply with ST rather than BELDaniel Eklöf2019-07-18-1/+1
| | | | | This is the preferred terminator anyway, and at least Emacs likes it a whole lot better.
* osc: implement foreground/background queryDaniel Eklöf2019-07-18-3/+34
|
* osc: recognize, but ignore, 112 (reset text cursor color)Daniel Eklöf2019-07-16-0/+1
|
* performance improvementsDaniel Eklöf2019-07-07-5/+4
| | | | | | | | | * action() returns void - this gets rid of checks in vt_from_slave() * split up ACTION_PRINT into ACTION_PRINT (ASCII) and ACTION_UTF8_PRINT ACTION_PRINT is on the hot path, and we want it streamlined. * Remove run-time checkout for unimplemented state transitions, as we shouldn't have any of those left. * Don't re-load current VT state on each iteration in vt_from_slave()
* osc: recognize, but ignore, OSC 104 and OSC 105Daniel Eklöf2019-07-05-0/+4
|
* osc: fix param calculation with more than one digitDaniel Eklöf2019-07-05-0/+1
|
* render: break out rendering functions to render.{c,h}Daniel Eklöf2019-07-05-5/+3
|
* osc: implement change window title and iconDaniel Eklöf2019-07-05-1/+40
|
* logging: disable debug logging by defaultDaniel Eklöf2019-07-03-1/+1
|
* wip: vt parsing: initial csi/osc dispatchingDaniel Eklöf2019-06-15-0/+12