<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/foot.git/terminal.h, branch 1.14.0</title>
<subtitle>A fast, lightweight and minimalistic Wayland terminal emulator</subtitle>
<id>https://git.0x0f.dev/mirrors/foot.git/atom?h=1.14.0</id>
<link rel='self' href='https://git.0x0f.dev/mirrors/foot.git/atom?h=1.14.0'/>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/'/>
<updated>2023-03-30T14:13:19Z</updated>
<entry>
<title>term: protect against integer overflow when accumulating scroll damage</title>
<updated>2023-03-30T14:13:19Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2023-03-28T16:37:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=981e4b77cb96ab277ea3b7a1e8aebf0e4589c032'/>
<id>urn:sha1:981e4b77cb96ab277ea3b7a1e8aebf0e4589c032</id>
<content type='text'>
When accumulating scroll damage, we check if the last scroll damage’s
scrolling region, and type, matches the new/current scroll damage. If
so, the number of lines in the last scroll damage is increased,
instead of adding a new scroll damage instance to the list.

If the scroll damage list isn’t consumed, this build up of scroll
damage would eventually overflow.

And, even if it didn’t overflow, it could become large enough, that
when later used to calculate e.g. the affected surface area, while
rendering a frame, would cause an overflow there instead.

This patch fixes both issues by:

a) do an overflow check before increasing the line count
b) limit the line count to UINT16_MAX
</content>
</entry>
<entry>
<title>render: fix glitchy selection while resizing the ‘normal’ screen</title>
<updated>2023-03-27T14:53:41Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2023-03-27T14:53:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=296e75f4f54f56be7d36fcccb032dca9e5be959b'/>
<id>urn:sha1:296e75f4f54f56be7d36fcccb032dca9e5be959b</id>
<content type='text'>
The selection coordinates are in absolute row numbers. As such,
selection breaks when interactively resizing the normal grid, since we
then instantiate a temporary grid mapping directly to the current
viewport (for performance reason, to avoid reflowing the entire grid
over and over again).

Fix by stashing the actual selection coordinates, and ajusting the
"active" ones to the temporary grid.
</content>
</entry>
<entry>
<title>interactive resize: improve user experience</title>
<updated>2022-10-17T16:49:57Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-10-17T16:49:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=0ac0d0647ae996bcef119d885cbd2d22a9940d8d'/>
<id>urn:sha1:0ac0d0647ae996bcef119d885cbd2d22a9940d8d</id>
<content type='text'>
Re-initialize the temporary ‘normal’ grid instance each time we
receive a configure event while doing an interactive resize.

This way, window content will not be "erased" when the window is first
made smaller, then larger again.

And, if the viewport is up in the scrollback history, increasing the
window size will reveal more of the scrollback, instead of just being
black.

The last issue is the cursor; it’s currently not "stuck" where it
should be. Instead, it follows the window around. This is due to two
things:

1) the temporary grid we create is large enough to contain the current
   viewport, but not more than that. That means we can’t "scroll up", to
   hide the cursor.

2) grid_resize_without_reflow() doesn’t know anything about
   "interactive resizing". As such, it will ensure the cursor is bound
   to the new grid dimensions.

I don’t yet have a solution for this. This patch implements a
workaround to at least reduce the impact, by simply hiding the cursor
while we’re doing an interactive resize.
</content>
</entry>
<entry>
<title>render: rename term-&gt;render.resizing -&gt; term-&gt;interactive_resizing</title>
<updated>2022-10-10T15:19:18Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-10-09T14:17:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=298f210ed93a83a531a44f772172da7f64510217'/>
<id>urn:sha1:298f210ed93a83a531a44f772172da7f64510217</id>
<content type='text'>
But also, more importantly, logical fixes:

* Stash the number of new scrollback lines the stashed ‘normal’ grid
  should be resized *to*.

There’s also a couple of performance changes here:

* When doing a delayed reflow (tiocswinsz timer), call
  sixel_reflow_grid(term, &amp;term-&gt;normal) - there’s no need to reflow
  sixels in the ‘alt’ screen.

* When doing a delayed reflow, free all scroll damage. It’s not
  needed, since we’re damaging the entire window anyway.

* Use minimum size for the temporary ‘normal’ grid (that contains the
  current viewport). We just need it to be large enough to fit the
  current viewport, and be a valid grid row count (power of 2). This
  just so happens to be the current ‘alt’ grid’s row count...
</content>
</entry>
<entry>
<title>term_ptmx_{pause,resume}: return success/fail</title>
<updated>2022-10-10T15:19:18Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-10-09T14:16:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=c5c97c2fd4a674d0fcce16d40e0e56994195e9b0'/>
<id>urn:sha1:c5c97c2fd4a674d0fcce16d40e0e56994195e9b0</id>
<content type='text'>
</content>
</entry>
<entry>
<title>render: resize: ignore ptmx read events during interactive resize</title>
<updated>2022-10-10T15:19:18Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-10-06T15:23:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=f4f1989b6ef341557cc90a6805d745fef2a7a815'/>
<id>urn:sha1:f4f1989b6ef341557cc90a6805d745fef2a7a815</id>
<content type='text'>
</content>
</entry>
<entry>
<title>render: delay reflow for ‘resize-delay-ms’ milliseconds</title>
<updated>2022-10-10T15:19:17Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-10-05T15:05:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=8179d73daa95dc3b3bdd76eaecc78e456bb4686a'/>
<id>urn:sha1:8179d73daa95dc3b3bdd76eaecc78e456bb4686a</id>
<content type='text'>
Reflowing a large scrollback is *slow*. During an interactive resize,
it can easily take long enough that the compositor fills the Wayland
socket with configure events. Eventually, the socket becomes full and
the compositor terminates the connection, causing foot to exit.

This patch is work-in-progress, and the first step towards alleviating
this.

It delays the reflow by:

* Snapshotting (copying) the original grid when an interactive resize
  is started.
* While resizing, we apply a simple truncation resize of the
  grid (like we handle the alt screen).
* When the resize is done, or paused for ‘resize-delay-ms’, the grid
  is reflowed.

TODO: we *must* not allow any changes to the temporary (truncated)
grid during the resize. Any changes to the grid would be lost when the
final reflow is applied. That is, we must completely pause the ptmx
pipe while a resize is in progress.

Future improvements:

The initial copy can be slow. We should be able to avoid it by
rewriting the reflow algorithm to not free anything. This is
complicated by the fact that some resources (e.g. sixel images) are
currently *moved* to the new grid. They’d instead have to be copied.
</content>
</entry>
<entry>
<title>render: apply a dimmed overlay while in Unicode input mode</title>
<updated>2022-08-08T14:31:28Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-08-08T14:31:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=e249b52abd59024e0a933f93b458d7bf4e780222'/>
<id>urn:sha1:e249b52abd59024e0a933f93b458d7bf4e780222</id>
<content type='text'>
</content>
</entry>
<entry>
<title>osc: add support for OSC 133;A (prompt markers)</title>
<updated>2022-06-16T17:02:10Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-06-15T16:44:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=bdb79e8b9fb36f627bb204ce2060dd5a877f3712'/>
<id>urn:sha1:bdb79e8b9fb36f627bb204ce2060dd5a877f3712</id>
<content type='text'>
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
</content>
</entry>
<entry>
<title>search: don't modify search.start coord *before* finding next match</title>
<updated>2022-04-21T16:54:27Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-21T16:54:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=9907d7bbe956840d75630702b6f48ee5be60f61f'/>
<id>urn:sha1:9907d7bbe956840d75630702b6f48ee5be60f61f</id>
<content type='text'>
The match logic uses the last start coordinate to determine which end
points in the selection to update. This sometimes fails when the start
coordinate has been changed by e.g. a key binding - the new start
coordinate is incorrectly matched against the old-but-modified start
coordinate, causing foot to e.g. *not* upate the selection start
coordinate.

Example:

  $ echo 'test\n\test\ntest'

Then do a scrollback search for 'test. The first match is found
correctly (the last 'test'), but searching for the previous match
(ctrl+r) does not select the middle 'test'.

Fix by passing the search direction to search_find_next(), and have
_it_ calculate the coordinate to start search. There are three possibilities:

* forward
* backward
* "backward", but at the same position

The first two are used when searching for next/prev match with ctrl+s
and ctrl+r. The last one is used when the search criteria is
updated. In this case, we don't want to move to the previous match,
*unless* the current match no longer matches.
</content>
</entry>
<entry>
<title>wayland: refactor: remove ‘struct config’ pointer from wayland struct</title>
<updated>2022-04-17T14:34:04Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-17T14:29:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=24ee3dcc10c5e1cf57456cc39fa0b5e8700a06ed'/>
<id>urn:sha1:24ee3dcc10c5e1cf57456cc39fa0b5e8700a06ed</id>
<content type='text'>
The global config doesn’t necessarily reflect the correct
configuration to use - we should *always* use the current terminal
instance’s conf pointer.

* Move selection override modifier mask to the key_binding_set struct
* Always warn if XDG activation is unavailable, not just if
  bell.urgent is set (we no longer have access to this information)
* Pass ‘bool presentation_timings’ as a parameter to wayl_init()
* Remove ‘presentation_timings’ member from the ‘terminal’ struct

Closes #932
</content>
</entry>
<entry>
<title>key-binding: new API, for handling sets of key bindings</title>
<updated>2022-04-17T13:39:51Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-17T13:39:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=90a2ca966f657e5fdd82997aad9663e9984f3cc9'/>
<id>urn:sha1:90a2ca966f657e5fdd82997aad9663e9984f3cc9</id>
<content type='text'>
Up until now, our Wayland seats have been tracking key bindings. This
makes sense, since the seat’s keymap determines how the key bindings
are resolved.

However, tying bindings to the seat/keymap alone isn’t enough, since
we also depend on the current configuration (i.e. user settings) when
resolving a key binding.

This means configurations that doesn’t match the wayland object’s
configuration, currently don’t resolve key bindings correctly. This
applies to footclients where the user has overridden key bindings on
the command line (e.g. --override key-bindings.foo=bar).

Thus, to correctly resolve key bindings, each set of key bindings must
be tied *both* to a seat/keymap, *and* a configuration.

This patch introduces a key-binding manager, with an API to
add/remove/lookup, and load/unload keymaps from sets of key bindings.

In the API, sets are tied to a seat and terminal instance, since this
makes the most sense (we need to instantiate, or incref a set whenever
a new terminal instance is created). Internally, the set is tied to a
seat and the terminal’s configuration.

Sets are *added* when a new seat is added, and when a new terminal
instance is created. Since there can only be one instance of each
seat, sets are always removed when a seat is removed.

Terminals on the other hand can re-use the same configuration (and
typically do). Thus, sets ref-count the configuration. In other words,
when instantiating a new terminal, we may not have to instantiate a
new set of key bindings, but can often be incref:ed instead.

Whenever the keymap changes on a seat, all key bindings sets
associated with that seat reloads (re-resolves) their key bindings.

Closes #931
</content>
</entry>
<entry>
<title>url-mode: add a key binding that enables “persistent” URL mode</title>
<updated>2022-04-17T09:24:27Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-03-22T18:07:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=501a9fbb5e1ec09c26cf61c464cf5b4ae6dba28a'/>
<id>urn:sha1:501a9fbb5e1ec09c26cf61c464cf5b4ae6dba28a</id>
<content type='text'>
This is an alternative to ‘show-urls-launch’, where we stay in URL
mode after activating an URL.

Closes #964
</content>
</entry>
<entry>
<title>search: break out “find next match” logic to a new function</title>
<updated>2022-04-16T18:13:22Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-16T18:13:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=bd089c845f32016e450eced3cfbf9e82657fb771'/>
<id>urn:sha1:bd089c845f32016e450eced3cfbf9e82657fb771</id>
<content type='text'>
</content>
</entry>
<entry>
<title>render: implement ‘flash’ and search mode’s ‘dimming’ with a sub-surface</title>
<updated>2022-04-16T16:31:02Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-16T15:49:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=78fcdc578755af0c3a52a46521dbb4d9804ab790'/>
<id>urn:sha1:78fcdc578755af0c3a52a46521dbb4d9804ab790</id>
<content type='text'>
Search mode and ‘flash’ (OSC-555) both achieves similar visual
effects: flash tints the entire window yellow, and search mode dims
it (except the search match).

But, they do so in completely different ways. Search mode is detected
in render_cell(), and the colors are then dimmed there.

Flash is implemented by blending a yellow, semi-transparent color on
top of the rendered grid.

This patch replaces those two implementations with a single one. We
add a new sub-surface, called the ‘overlay’. In normal mode, it’s
unmapped.

When either search mode, or flash, is enabled, we enable it, and
fill it with a semi-transparent color. Yellow for ‘flash’, and
“black” (i.e. no color) for search mode.

The compositor then blends it with the grid. Hopefully on the GPU,
meaning it’ll be faster than if we blend in software.

There are more performance benefits however. By using a separate
surface, we can do much better damage tracking.

The normal grid rendering code no longer have to care about neither
search mode, nor flash. Thus, we get rid of a couple of ‘if’
statements in render_cell(), which is nice. But more importantly, we
can drop full grid repaints in a couple of circumstances:

* Entering/exiting search mode
* Every frame while flash is active

Now, when rendering the search mode overlay, we do want to do some
damage tracking, also of the overlay.

This, since search mode doesn’t dim the *entire* window. The search
match is *not* dimmed. This is implemented by punching a hole in the
overlay sub-surface. That is, we make part of it *fully*
transparent. The basic idea is to set a clip region that excludes the
search match, and then dim the rest of the overlay.

It’s slightly more complicated than that however, if we want to reuse
the last frame’s overlay buffer (i.e we don’t want to re-render
the *entire* overlay every frame).

In short, we need to:

* Clear (punch hole) in areas that are part of this frame’s search
  match, but not the last frame’s (since those parts are _already_
  cleared).
* Dim the areas that were part of the last frame’s search match, but
  aren’t anymore (the rest of the overlay should already be dimmed).

To do this, we save the last frame’s “holes” (as a pixman
region). Then, when rendering the next frame, we first calculate the
new frame’s “holes” region.

The region to clear is “this frame’s holes minus last frame’s holes”
The region to dim is “last frame’s holes minus this frames holes”.

Finally, we compute the bounding box of all modified cells by taking
the union of the two diff regions mentioned above. This allows us to
limit the buffer damage sent to the compositor.
</content>
</entry>
<entry>
<title>wayland: optionally disable pointer input on subsurfaces</title>
<updated>2022-04-16T15:41:14Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-16T15:41:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=129deaffa82650a1383f5816aa46f4a78a73b2ed'/>
<id>urn:sha1:129deaffa82650a1383f5816aa46f4a78a73b2ed</id>
<content type='text'>
We have a number of sub-surfaces for which we are *not* interrested in
pointer (or touch) input.

Up until now, we’ve manually dealt with these, by recognizing these
surfaces in all pointer events, and ignoring them.

But, lo and behold, there are better ways of doing this. By clearing
the subsurface’s input region, the compositor will do this for us -
when a pointer is outside a surface’s input region, the event is
passed to the next surface underneath it.

This is exactly what we want! Do this for all subsurfaces, *except*
the CSDs.
</content>
</entry>
<entry>
<title>client: add -E,--client-environment</title>
<updated>2022-04-12T13:07:40Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-11T10:19:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=d02124902b4e27c3ed3ef48442ce17c5e0af9d56'/>
<id>urn:sha1:d02124902b4e27c3ed3ef48442ce17c5e0af9d56</id>
<content type='text'>
When this option is used, the child process in the new terminal
instance will inherit its environment from the footclient process,
instead of the foot server’s.

Implemented by sending (yet another) dynamic string list as part of
the client -&gt; server setup packet. When the new option is *not* used,
the setup packet is now 2 bytes larger than before.

On the server side, the slave process now uses execvpe() instead of
execvp(). There’s plumbing to propagate a new ‘envp’ argument from
term_init() all the way down to slave_exec(). If ‘envp’ is NULL, we
use ‘environ’ instead (thus matching the old behavior of execvp()).

Closes #1004
</content>
</entry>
<entry>
<title>refactor: add a ‘range’ struct, grouping a start and end coord together</title>
<updated>2022-04-09T13:09:02Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-09T13:09:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=5b1f1602bccfb7c37e50a8509f44b24e9aa3b5d1'/>
<id>urn:sha1:5b1f1602bccfb7c37e50a8509f44b24e9aa3b5d1</id>
<content type='text'>
</content>
</entry>
<entry>
<title>csi: add support for DECNKM private mode</title>
<updated>2022-03-19T13:44:14Z</updated>
<author>
<name>Craig Barnes</name>
<email>craigbarnes@protonmail.com</email>
</author>
<published>2022-03-19T13:14:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=8d4d22218e63c88a7b9897219272775fc575da33'/>
<id>urn:sha1:8d4d22218e63c88a7b9897219272775fc575da33</id>
<content type='text'>
This is equivalent to DECKPAM/DECKPNM when enabled/disabled, but can
also be saved/restored/queried with XTSAVE/XTRESTORE/DECRQM.

See also:

* https://vt100.net/docs/vt510-rm/DECNKM.html
* https://vt100.net/docs/vt510-rm/DECKPAM.html
* https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-PC-Style-Function-Keys
</content>
</entry>
<entry>
<title>csi/input: remove private mode 27127</title>
<updated>2022-02-09T20:50:20Z</updated>
<author>
<name>Craig Barnes</name>
<email>craigbarnes@protonmail.com</email>
</author>
<published>2022-02-09T20:50:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=e32707ffc04a5c4acee62680f080c927d96e1836'/>
<id>urn:sha1:e32707ffc04a5c4acee62680f080c927d96e1836</id>
<content type='text'>
This effectively reverts commit 31c73f0cf01e1d0bdcd1435136b010c1c1ab442c.
</content>
</entry>
</feed>
