<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/foot.git/terminal.h, branch 1.15.0</title>
<subtitle>A fast, lightweight and minimalistic Wayland terminal emulator</subtitle>
<id>https://git.0x0f.dev/mirrors/foot.git/atom?h=1.15.0</id>
<link rel='self' href='https://git.0x0f.dev/mirrors/foot.git/atom?h=1.15.0'/>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/'/>
<updated>2023-07-03T12:36:32Z</updated>
<entry>
<title>refactor: track current xcursor using an enum, instead of a char pointer</title>
<updated>2023-07-03T12:36:32Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2023-06-27T14:57:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=ee794a121e4603d01fb662ad6d1f3b18b6937d2c'/>
<id>urn:sha1:ee794a121e4603d01fb662ad6d1f3b18b6937d2c</id>
<content type='text'>
</content>
</entry>
<entry>
<title>sixel: re-scale images when the cell dimensions change</title>
<updated>2023-06-30T06:29:35Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2023-06-29T12:49:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=49fb0cf359bb2486bbdf58df62c66c890d7e31cd'/>
<id>urn:sha1:49fb0cf359bb2486bbdf58df62c66c890d7e31cd</id>
<content type='text'>
Before this patch, when the cell dimensions changed (i.e. when the
font size changes), sixel images were either removed (the new cell
dimensions are smaller than the old), or simply kept at their original
size (new cell dimensions are larger).

With this patch, sixels are instead resized. This means a
sixel *always* occupies the same number of rows and columns,
regardless of how much the font size is changed.

This is done by maintaining two sets of image data and pixman images,
as well as their dimensions. These two sets are the new ‘original’ and
‘scaled’ members of the sixel struct.

The "top-level" pixman image pointer, and the ‘width’ and ‘height’
members either point to the "original", or the "scaled" version.

They are invalidated as soon as the cell dimensions change. They, and
the ‘scaled’ image is updated on-demand (when we need to render a
sixel).

Note that the ‘scaled’ image is always NULL when the current cell
dimensions matches the ones used when emitting the sixel (to save
run-time memory).

Closes #1383
</content>
</entry>
<entry>
<title>sixel: special case parsing of images with an aspect ratio of 1:1</title>
<updated>2023-06-29T13:40:00Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2023-06-27T12:25:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=3555e81fee4a069bf4886007082f676b8777f6f9'/>
<id>urn:sha1:3555e81fee4a069bf4886007082f676b8777f6f9</id>
<content type='text'>
Images with an aspect ratio of 1:1 are by far the most common (though
not the default).

It makes a lot of sense, performance wise, to special case
them.

Specifically, the sixel_add() function benefits greatly from this, as
it is the inner most, most heavily executed function when parsing a
sixel image.

sixel_add_many() also benefits, since allows us to drop a
multiplication. Since sixel_add_many() always called first (no other
call sites call sixel_add() directly), this has a noticeable effect on
performance.

Another thing that helps (though not as much), and not specifically
with AR 1:1 images, is special casing DECGRI a bit.

Up until now, it simply updated the current sixel parameter value. The
problem is that the default parameter value is 0. But, a value of 0
should be treated as 1. By adding a special ‘repeat_count’ variable to
the sixel struct, we can initialize it to ‘1’ when we see DECGRI, and
then simply overwrite it as the parameter value gets updated. This
allows us to drop an if..else when emitting the sixel.
</content>
</entry>
<entry>
<title>term: convert ‘scale’ to a float</title>
<updated>2023-06-29T13:38:22Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2023-06-22T12:21:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=c1f374cc8dab121388669cee6df3e2d1c483d77f'/>
<id>urn:sha1:c1f374cc8dab121388669cee6df3e2d1c483d77f</id>
<content type='text'>
</content>
</entry>
<entry>
<title>sixel: stop cropping images to the last non-transparent row</title>
<updated>2023-06-24T05:31:08Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2023-06-19T17:09:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=774570ec41a3c585f40b03467eaada786a2e97d3'/>
<id>urn:sha1:774570ec41a3c585f40b03467eaada786a2e97d3</id>
<content type='text'>
</content>
</entry>
<entry>
<title>sixel: respect sixel aspect ratio</title>
<updated>2023-06-24T05:31:08Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2023-06-19T17:06:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=d6d143e2a6916178d1ea74551617cf8a5cddc39e'/>
<id>urn:sha1:d6d143e2a6916178d1ea74551617cf8a5cddc39e</id>
<content type='text'>
That is, parse P1 when initializing a new sixel, and don’t ignore
pad/pad in the raster attributes command.

The default aspect ratio is 2:1, but most sixels will override it in
the raster attributes command (to 1:1).
</content>
</entry>
<entry>
<title>term: add term_cursor_col()</title>
<updated>2023-06-20T12:55:32Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2023-06-16T14:33:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=24f12c7b5e753a5152eac44da9024954d43250e9'/>
<id>urn:sha1:24f12c7b5e753a5152eac44da9024954d43250e9</id>
<content type='text'>
Set cursor column, absolute.

term_cursor_to() needs to reload the current row pointer, and is thus
not very effective when we only need to modify the column.
</content>
</entry>
<entry>
<title>vt: split up action_param() to three separate functions</title>
<updated>2023-06-16T14:26:13Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2023-06-16T14:26:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=d88bea5e22330c36c241ae0d441279799ac5897f'/>
<id>urn:sha1:d88bea5e22330c36c241ae0d441279799ac5897f</id>
<content type='text'>
We’re already switching on the next VT input byte in the state
machine; no need to if...else if in action_param() too.

That is, split up action_param() into three:

* action_param_new()
* action_param_new_subparam()
* action_param()

This makes the code cleaner, and hopefully slightly faster.

Next, to improve performance further, only check for (sub)parameter
overflow in action_param_new() and action_param_subparam().

Add pointers to the VT struct that points to the currently active
parameter and sub-parameter.

When the number of parameters (or sub-parameters) overflow, warn, and
then point the parameter pointer to a "dummy" value in the VT struct.

This way, we don’t have to check anything in action_param().
</content>
</entry>
<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>
</feed>
