<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/foot.git/terminal.h, branch 1.10.0</title>
<subtitle>A fast, lightweight and minimalistic Wayland terminal emulator</subtitle>
<id>https://git.0x0f.dev/mirrors/foot.git/atom?h=1.10.0</id>
<link rel='self' href='https://git.0x0f.dev/mirrors/foot.git/atom?h=1.10.0'/>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/'/>
<updated>2021-11-13T10:09:07Z</updated>
<entry>
<title>input: add support for modifyOtherKeys=2</title>
<updated>2021-11-13T10:09:07Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-11-11T16:43:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=4a740509996d3a7e8808593d1cbc0128b1ae03ed'/>
<id>urn:sha1:4a740509996d3a7e8808593d1cbc0128b1ae03ed</id>
<content type='text'>
Similar to modifyOtherKeys=1 (foot’s default, and only, mode), except
that:

* All modifiers (and not just Ctrl) generate \E[27;m;n~ escapes
* Regular keys (with modifiers) also generate \E[27;m;n~ escapes (for
  example, C-h no longer generates ^H, but \E[27;5;104~)

For our keymap based lookups, this is handled by adding
MOD_MODIFY_OTHER_KEYS_STATE&lt;N&gt; variants.

For “generic” keys, we simply adjust the conditions for when to emit a
\E[27;m;n~ escape - the only requirement is that at least one modifier
is active.
</content>
</entry>
<entry>
<title>config: add {str,value}_to_uint{16,32}()</title>
<updated>2021-11-13T10:04:29Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-11-06T11:01:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=d29c3cf7b76c6a1935684124b4d7cad69de94c78'/>
<id>urn:sha1:d29c3cf7b76c6a1935684124b4d7cad69de94c78</id>
<content type='text'>
This allows us to pass the final pointer directly to the conversion
functions, as well as allowing us to print outside-range errors.
</content>
</entry>
<entry>
<title>foot/client: implement xdga client activation</title>
<updated>2021-11-01T01:52:29Z</updated>
<author>
<name>Ronan Pigott</name>
<email>rpigott@berkeley.edu</email>
</author>
<published>2021-10-29T00:51:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=99d5bf64bca5daa70e3e8c5a4d63a257ba7e6fb8'/>
<id>urn:sha1:99d5bf64bca5daa70e3e8c5a4d63a257ba7e6fb8</id>
<content type='text'>
This is an application of the xdg activation protocol that will allow
compositors to associate new foot toplevels with the command that
launched them.

footclient receives an activation token from the launcher which the
compositor can use to track application startup. It passes the token
to the foot server, which then activates the new window with the token
to complete the startup sequence.
</content>
</entry>
<entry>
<title>osc: use BEL terminator in OSC replies to BEL-terminated OSC queries</title>
<updated>2021-10-20T11:48:37Z</updated>
<author>
<name>Craig Barnes</name>
<email>craigbarnes@protonmail.com</email>
</author>
<published>2021-10-20T11:48:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=52dcf72d0b80b9f4c159744447b34d215a38d24c'/>
<id>urn:sha1:52dcf72d0b80b9f4c159744447b34d215a38d24c</id>
<content type='text'>
This matches the documented (and observed) behavior in xterm:

&gt; XTerm accepts either BEL or ST for terminating OSC sequences, and
&gt; when returning information, uses the same terminator used in a query

-- https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands
</content>
</entry>
<entry>
<title>term: only scale using DPI if *all* monitors have a scaling factor or one</title>
<updated>2021-09-24T20:07:47Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-09-19T09:58:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=fb77637eb96a71de48b49e40fbe7dd71ec85bcbf'/>
<id>urn:sha1:fb77637eb96a71de48b49e40fbe7dd71ec85bcbf</id>
<content type='text'>
With dpi-aware=auto (the default), scale fonts using DPI *only*
if *all* available monitors have a scaling factor of one.

The idea is this: if a user, with multiple monitors, have enabled
scaling on *at least* one monitor, he/she has most likely done so to
match the size of his/hers other monitors.

For example, if the user has one monitor with a scaling factor of one,
and another one with a scaling factor of two, he/she expects things to
be twice as large on the second monitor.

If we (foot) scale using DPI on the first monitor, and using the
scaling factor on the second monitor, foot will *not* look twice as
big on the second monitor (this was the old behavior of
dpi-aware=auto).

Part of #714
</content>
</entry>
<entry>
<title>term: turn ‘box-drawings’ array into three dynamically allocated arrays</title>
<updated>2021-09-14T07:50:49Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-09-14T07:50:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=37b15adcd8306652ce21804cb6140d1361adc94f'/>
<id>urn:sha1:37b15adcd8306652ce21804cb6140d1361adc94f</id>
<content type='text'>
The box_drawings array is now quite large, and uses up ~4K
when *empty*.

This patch splits it up into three separate, dynamically allocated
arrays; one for the traditional box+line drawing and block elements
glyphs, one for braille, and one for the legacy computing symbols.

When we need to render a glyph, the *entire* array (that it belongs
to) is allocated.

I.e this is one step closer to a dynamic glyph cache (like the one
fcft uses), but doesn’t go all the way.

This is especially nice for people with
‘box-drawings-uses-font-glyphs=yes’; for them, the custom glyphs now
uses 3*8 bytes (for the three array pointers), instead of 4K.
</content>
</entry>
<entry>
<title>box-drawing: add braille characters</title>
<updated>2021-09-12T17:22:12Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-09-02T12:55:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=b4c759e2de429c20bf07c9e16162d154152014d9'/>
<id>urn:sha1:b4c759e2de429c20bf07c9e16162d154152014d9</id>
<content type='text'>
Render braille ourselves, instead of using font glyphs. Decoding a
braille character is easy enough; there are 256 codepoints,
represented by an 8-bit integer (i.e. subtract the Unicode codepoint
offset, 0x2800, and you’re left with an integer in the range 0-255).

Each bit corresponds to a dot. The first 6 bits represent the upper 6
dots, while the two last bits represent the fourth (and last) row of
dots.

The hard part is sizing the dots and the spacing between them.

The aim is to have the spacing between the dots be the same size as
the dots themselves, and to have the margins on each side be half the
size of the dots.

In a perfectly sized cell, this means two braille characters next to
each other will be evenly spaced.

This is however almost never the case. The layout logic currently:

* Set dot size to either the width / 4, or height / 8, depending on
  which one is smallest.

* Horizontal spacing is initialized to the width / 4

* Vertical spacing is initialized to the height / 8

* Horizontal margins are initialized to the horizontal spacing / 2

* Vertical margins are initialized to the vertical spacing / 2.

Next, we calculate the number of “remaining” pixels. That is, if we
add the left margin, two dots and the spacing between, how many pixels
are left on the horizontal axis?

These pixels are distributed in the following order (we “stop” as soon
as we run out of pixels):

* If the dot size is 0 (happens for very small font sizes), increase
  it to 1.
* If the margins are 0, increase them to 1.
* If we have enough pixels (need at 2 horizontal and 4 vertical),
  increase the dot size.
* Increase spacing.
* Increase margins.

Closes #702
</content>
</entry>
<entry>
<title>sixel: avoid looking up color from palette for each sixel</title>
<updated>2021-09-05T09:08:13Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-09-05T09:08:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=47c32d5913044912f5e0974ab6554de1f2a62b3b'/>
<id>urn:sha1:47c32d5913044912f5e0974ab6554de1f2a62b3b</id>
<content type='text'>
Instead, do the palette lookup when we receive the DECGCI (i.e. when
the palette entry is selected), and store the actual color value in
our sixel struct.
</content>
</entry>
<entry>
<title>sixel: calculate default bg once, in init</title>
<updated>2021-09-05T08:27:13Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-09-05T08:27:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=f9642e959725fc43ad7dac0e3c8be842d53aa903'/>
<id>urn:sha1:f9642e959725fc43ad7dac0e3c8be842d53aa903</id>
<content type='text'>
We have all information we need to calculate the default background
color in sixel_init():

* Whether the image have transparency or not
* The current ANSI background color
</content>
</entry>
<entry>
<title>selection: don’t require two cell attr bits for selection updating</title>
<updated>2021-08-16T17:15:41Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-08-13T15:45:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=ae70596a5034f9fd6bbca6b42e4fe52c42c70d34'/>
<id>urn:sha1:ae70596a5034f9fd6bbca6b42e4fe52c42c70d34</id>
<content type='text'>
When updating the selection (i.e when changing it - adding or removing
cells to the selection), we need to do two things:

* Unset the ‘selected’ bit on all cells that are no longer selected.
* Set the ‘selected’ bit on all cells that *are* selected.

Since it’s quite tricky to calculate the difference between the “old”
and “new” selection, this is done by first un-selecting the old
selection, and then selecting the new, updated selection. I.e. first
we clear the ‘selected’ bit from *all* cells, and then we re-set it on
those cells that are still selected.

This process also dirties the cells, to make sure they are
re-rendered (needed to reflect their new selected/un-selected status).

To avoid dirtying *all* previously selected, and newly selected cells,
we have used an algorithm that first runs a “pre-pass”, marking all
cells that *will* be selected as such. The un-select pass would then
skip (no dirty) cells that have been marked by the pre-pass. Finally,
the select pass would only dirty cells that have *not* been marked by
the pre-pass.

In short, we only dirty cells whose selection state have *changed*.

To do this, we used a second ‘selected’ bit in the cell attribute
struct.

Those bits are *scarce*.

This patch implements an alternative algorithm, that frees up one of
the two ‘selected’ bits.

This is done by lazy allocating a bitmask for the entire grid. The
pre-pass sets bits in the bitmask. Thus, after the pre-pass, the
bitmask has set bits for all cells that *will* be selected.

The un-select pass simply skips cells with a one-bit in the
bitmask. Cells without a one-bit in the bitmask are dirtied, and their
‘selected’ bit is cleared.

The select-pass doesn’t even have to look at the bitmask - if the cell
already has its ‘selected’ bit set, it does nothing. Otherwise it sets
it and dirties the cell.

The bitmask is implemented as an array of arrays of 64-bit
integers. Each outer element represents one row. These pointers are
calloc():ed before starting the pre-pass.

The pre-pass allocates the inner arrays on demand.

The unselect pass is designed to handle both the complete absence of a
bitmask, as well as row entries being NULL (both means the cell
is *not* pre-marked, and will thus be dirtied).
</content>
</entry>
<entry>
<title>pt-or-px: heed the dpi-aware setting</title>
<updated>2021-08-13T15:38:56Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-08-13T15:38:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=f6f8f2b35ec10eb09f2c7c5b8214b62fa87b59e5'/>
<id>urn:sha1:f6f8f2b35ec10eb09f2c7c5b8214b62fa87b59e5</id>
<content type='text'>
Before this patch, pt-or-px values, like letter-spacing, were *always*
scaled using the current DPI value.

This is wrong; if the fonts are scaled using the output’s scaling
factor, then so should all other point values.

This also fixes an issue where e.g. letter-spacing would use one DPI
value at startup, but then when increasing/decreasing or resetting the
font size, would be re-calculated using a different DPI value, leading
to completely different spacing.

This happened when there were multiple monitors, with different DPI
values, and foot guessed the initial DPI value wrong. Normally, foot
would correct itself as soon as the window was mapped, and the
“correct” DPI value known. But if the fonts were scaled using the
scaling factor, it was possible that the font reload never happened.

This patch also updates the thickness calculation (for LIGHT and HEAVY
box drawing characters) to use the scaling factor when appropriate.

Closes #680
</content>
</entry>
<entry>
<title>box-drawing: add U+1FB3C-U+1FB6F, U+1FB9A and U+1FB9B</title>
<updated>2021-08-05T16:25:01Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-08-03T16:10:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=1c43fdbea4751de9a84d24be8320712c85045414'/>
<id>urn:sha1:1c43fdbea4751de9a84d24be8320712c85045414</id>
<content type='text'>
These are the “wedges” from the Unicode 13 “Legacy Computing” symbols.

Closes #474
</content>
</entry>
<entry>
<title>term: consolidate shutdown related state into an anonymous struct</title>
<updated>2021-07-31T17:08:51Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-07-31T17:08:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=03f952cf4dcf45d909ce209838a3beb4304358e5'/>
<id>urn:sha1:03f952cf4dcf45d909ce209838a3beb4304358e5</id>
<content type='text'>
</content>
</entry>
<entry>
<title>term: asynchronous client application termination</title>
<updated>2021-07-31T16:18:48Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-07-31T16:18:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=384b1c330ffbee4318ee75c97186450f0f6e9e35'/>
<id>urn:sha1:384b1c330ffbee4318ee75c97186450f0f6e9e35</id>
<content type='text'>
When the foot window is closed, and we need to terminate the client application,
do this in an asynchronous fashion:

* Don’t do a blocking call to waitpid(), instead, rely on the reaper callback
* Use a timer FD to implement the timeout before sending SIGKILL (instead of
  using SIGALRM).
* Send SIGTERM immediately (we used to *just* close the PTY, and then wait 2
  seconds before sending SIGTERM).
* Raise the timeout from 2 seconds to 60

Full shutdown now depends on *two* asynchronous tasks - unmapping the window,
and waiting for the client application to terminate.

Only when *both* of these have completed do we proceed and call term_destroy(),
and the user provided shutdown callback.
</content>
</entry>
<entry>
<title>render: use a single backing SHM pool for CSD surface buffers</title>
<updated>2021-07-18T14:46:43Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-07-18T14:46:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=20fc80e57e365f2e002eead7de110cb23ffa7adc'/>
<id>urn:sha1:20fc80e57e365f2e002eead7de110cb23ffa7adc</id>
<content type='text'>
</content>
</entry>
<entry>
<title>csi: erase scrollback: cancel selection if it touches the scrollback</title>
<updated>2021-07-18T14:14:21Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-07-16T14:45:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=5f0ceb72f176caf7673ea1d4bc5195f26f4b4df7'/>
<id>urn:sha1:5f0ceb72f176caf7673ea1d4bc5195f26f4b4df7</id>
<content type='text'>
This breaks out the scrollback erasing logic for \E[3J from csi.c, and
moves it to the new function term_erase_scrollback(), and changes the
logic to calculate the start and end row (absolute) numbers of the
scrollback, and only iterate those, instead of iterating *all* rows,
filtering out those that are on-screen.

It also adds an intersection range check of the selection range, and
cancels the selection if it touches any of the deleted scrollback
rows.

This fixes a crash when trying to render the next frame, since the
selection now references rows that have been freed.

Closes #633
</content>
</entry>
<entry>
<title>shm: refactor: move away from a single, global, buffer list</title>
<updated>2021-07-17T17:14:42Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-07-16T14:48:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=53851e13ec976001cdec2077d7963c292bcd6d20'/>
<id>urn:sha1:53851e13ec976001cdec2077d7963c292bcd6d20</id>
<content type='text'>
Up until now, *all* buffers have been tracked in a single, global
buffer list. We've used 'cookies' to separate buffers from different
contexts (so that shm_get_buffer() doesn't try to re-use e.g. a
search-box buffer for the main grid).

This patch refactors this, and completely removes the global
list.

Instead of cookies, we now use 'chains'. A chain tracks both the
properties to apply to newly created buffers (scrollable, number of
pixman instances to instantiate etc), as well as the instantiated
buffers themselves.

This means there's strictly speaking not much use for shm_fini()
anymore, since its up to the chain owner to call shm_chain_free(),
which will also purge all buffers.

However, since purging a buffer may be deferred, if the buffer is
owned by the compositor at the time of the call to shm_purge() or
shm_chain_free(), we still keep a global 'deferred' list, on to which
deferred buffers are pushed. shm_fini() iterates this list and
destroys the buffers _even_ if they are still owned by the
compositor. This only happens at program termination, and not when
destroying a terminal instance. I.e. closing a window in a “foot
--server” does *not* trigger this.

Each terminal instatiates a number of chains, and these chains are
destroyed when the terminal instance is destroyed. Note that some
buffers may be put on the deferred list, as mentioned above.
</content>
</entry>
<entry>
<title>render: Allow cells to bleed into their neighbor</title>
<updated>2021-07-17T11:22:44Z</updated>
<author>
<name>Timur Celik</name>
<email>mail@timurcelik.de</email>
</author>
<published>2021-06-15T09:45:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=91801ae55da017c2dd0f44c04b8d316a9a2090ef'/>
<id>urn:sha1:91801ae55da017c2dd0f44c04b8d316a9a2090ef</id>
<content type='text'>
This patch adds a `confined` flag to each cell to track if the last
rendered glyph bled into it's right neighbor.  To keep things simple,
bleeding into any other neighbor cell than the immediate right one is
not allowed.  This should cover most use cases.

Before rendering a row we now do a prepass and mark all cells unclean
that are affected by a bleeding neighbor.  If there are consecutive
bleeding cells, the whole group must be re-rendered even if only a
single cell has changed.

The patch also deprecates both old overflowing glyph options
*allow-overflowing-double-width-glyphs* and *pua-double-width* in favor
of a single new one named *overflowing-glyphs*.
</content>
</entry>
<entry>
<title>csi: invert the meaning of DECSDM</title>
<updated>2021-07-14T17:17:44Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-07-14T17:17:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=fcd989734235c25e64f8fb38ffcfdf381e933873'/>
<id>urn:sha1:fcd989734235c25e64f8fb38ffcfdf381e933873</id>
<content type='text'>
There has been some confusion whether enabling DECSDM (private mode
80) enables or disables sixel scrolling.

Foot currently enables scrolling when DECSDM is set, and this patch
changes this, such that setting DECSDM now *disables* scrolling.

The confusion is apparently due to a documentation error in the VT340
manual, as described in
https://github.com/dankamongmen/notcurses/issues/1782#issuecomment-863603641.

And that makes sense, in a way: the SDM in DECSDM stands for Sixel
Display Mode. I.e. it stands to reason that enabling that disables
scrolling.

Anyway, this lead to https://github.com/hackerb9/lsix/issues/41, where
it was eventually proven (by testing on a real VT340), that foot, and
a large number of other terminals (including XTerm) has it wrong:
https://github.com/hackerb9/lsix/issues/41#issuecomment-873269599.
</content>
</entry>
<entry>
<title>url-mode: fix crash when removing duplicate and/or overlapping URLs</title>
<updated>2021-07-11T08:06:12Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-07-11T08:06:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=cf6d04f9f2fcb7a4f12d35edd0a6d4cd5591b59c'/>
<id>urn:sha1:cf6d04f9f2fcb7a4f12d35edd0a6d4cd5591b59c</id>
<content type='text'>
Removing overlaping and duplicated URLs is done by running two nested
loops, that both iterate the same URL list.

When a duplicate is found, one of the URLs is destroyed and removed
from the list.

Deleting and removing an item *is* safe, but only as long as _no
other_ iterator has references to it.

In this case, if we remove an item from e.g. the inner iterator, we’ll
crash if the outer iterator’s *next* item is the item being removed.

Closes #627
</content>
</entry>
</feed>
