<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/foot.git/vt.c, branch 1.16.0</title>
<subtitle>A fast, lightweight and minimalistic Wayland terminal emulator</subtitle>
<id>https://git.0x0f.dev/mirrors/foot.git/atom?h=1.16.0</id>
<link rel='self' href='https://git.0x0f.dev/mirrors/foot.git/atom?h=1.16.0'/>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/'/>
<updated>2023-09-25T14:50:44Z</updated>
<entry>
<title>csi: implement DECSET/DECRST/DECRQM 2027 - grapheme cluster processing</title>
<updated>2023-09-25T14:50:44Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2023-09-20T11:45:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=4eef001d5855b9b5afb59bbd3b92b3a2828fcca0'/>
<id>urn:sha1:4eef001d5855b9b5afb59bbd3b92b3a2828fcca0</id>
<content type='text'>
This implements private mode 2027 - grapheme cluster processing, as
defined in the "Terminal Unicode Core"[1] specification.

Internally, we just flip the already existing option "grapheme
shaping". Since it's now runtime changeable, we need a copy of it in
the terminal struct, rather than referencing the conf object.

[1]: https://github.com/contour-terminal/terminal-unicode-core/blob/13fc5a8993a033ff10c1f3433d08cb618cde4ac2/spec/terminal-unicode-core.tex#L50-L53
</content>
</entry>
<entry>
<title>vt: fix ASAN UB warning</title>
<updated>2023-08-05T05:19:51Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2023-08-05T05:19:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=12e0edd6e16ae4f59ee32d282ed56ab0c7e26a41'/>
<id>urn:sha1:12e0edd6e16ae4f59ee32d282ed56ab0c7e26a41</id>
<content type='text'>
  ../vt.c:648:13: runtime error: signed integer overflow: 3924432811 * 2654435761 cannot be represented in type 'long'
  SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../vt.c:648:13 in

Closes #1456
</content>
</entry>
<entry>
<title>vt: detect and ignore invalid UTF-8 sequences</title>
<updated>2023-07-22T09:21:41Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2023-07-22T09:21:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=b59fd7c388c8d59a08e7e30f07e4639d2fd5451f'/>
<id>urn:sha1:b59fd7c388c8d59a08e7e30f07e4639d2fd5451f</id>
<content type='text'>
This patch detects invalid codepoints in the UTF-8 EDxxxx range, and
the F4xxxxxx range.

Note that we still allow the E0xxxx and F0xxxxxx ranges. These
contains overlong encodings. We allow them, because they still decode
into correct UTF-32.

Closes #1423
</content>
</entry>
<entry>
<title>vt: improve handling of HTS</title>
<updated>2023-07-20T00:47:40Z</updated>
<author>
<name>CismonX</name>
<email>admin@cismon.net</email>
</author>
<published>2023-07-19T23:00:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=c3b119ea81a7b6bf01cf8ba064ab9df8f7c92f1e'/>
<id>urn:sha1:c3b119ea81a7b6bf01cf8ba064ab9df8f7c92f1e</id>
<content type='text'>
Do not insert existing positions into the tab stop list.

This prevents a performance issue when iterating through
an extremely long tab stop list.

Also corrects the behaviour of CBT.
</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>vt: tag collision-count check with ‘unlikely’</title>
<updated>2022-06-15T17:25:00Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-06-13T11:16:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=9dc4f48e7a00a2c59f955a4a6cab57ce68a01e4c'/>
<id>urn:sha1:9dc4f48e7a00a2c59f955a4a6cab57ce68a01e4c</id>
<content type='text'>
</content>
</entry>
<entry>
<title>vt: improve key calculation for compose sequences</title>
<updated>2022-06-15T17:25:00Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-06-13T11:11:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=fbcb30bf9870aa2b4d75376b3a02703576a715e4'/>
<id>urn:sha1:fbcb30bf9870aa2b4d75376b3a02703576a715e4</id>
<content type='text'>
* Don’t assume 32 bits when rotating the old key. Use the number of
  actual bits available, as determined by CELL_COMB_CHARS_{HI,LO}
* Multiply with magic hash constant

This greatly reduces the number of collisions seen. For example, the
Emoji test file (from the Unicode specification), now has zero
collisions.
</content>
</entry>
<entry>
<title>vt: prevent potential endless loop when finding a slot for a composed character</title>
<updated>2022-06-15T17:25:00Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-06-13T10:14:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=edd68732ad472a7a9ae824fe3be06f8f111754d6'/>
<id>urn:sha1:edd68732ad472a7a9ae824fe3be06f8f111754d6</id>
<content type='text'>
Composed characters are stored in a tree structure, using a key as
identifier. The key is calculated from the individual characters that
make up the composed character sequence.

Since the address space for keys is limited, collisions may occur. In
this case, we simply increment the key and try again.

It is theoretically possible to saturate the key space, in which case
we’ll get stuck in an endless loop.

Even if the key space isn’t fully saturated, we fairly easy reach a
point where there are so many collisions for each insertion, that
performance drops significantly.

Since key space is limited (it’s not like a hash table that we can
grow), our only option is to limit the number of collisions. If we
can’t find a slot within a hard code amount of collisions, the
character is simply dropped.
</content>
</entry>
<entry>
<title>vt: free OSC buffer after dispatch, if larger than 4K</title>
<updated>2022-03-21T19:40:10Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-03-20T15:31:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=0b9b726bdfb573337de09489ae0750070aec219a'/>
<id>urn:sha1:0b9b726bdfb573337de09489ae0750070aec219a</id>
<content type='text'>
</content>
</entry>
<entry>
<title>fcft: adapt to API changes in fcft-3.x</title>
<updated>2022-02-05T16:00:54Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-08-21T12:50:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=e0227266cabc015c282774ac898e3f52dce943df'/>
<id>urn:sha1:e0227266cabc015c282774ac898e3f52dce943df</id>
<content type='text'>
Fcft no longer uses wchar_t, but plain uint32_t to represent
codepoints.

Since we do a fair amount of string operations in foot, it still makes
sense to use something that actually _is_ a string (or character),
rather than an array of uint32_t.

For this reason, we switch out all wchar_t usage in foot to
char32_t. We also verify, at compile-time, that char32_t used
UTF-32 (which is what fcft expects).

Unfortunately, there are no string functions for char32_t. To avoid
having to re-implement all wcs*() functions, we add a small wrapper
layer of c32*() functions.

These wrapper functions take char32_t arguments, but then simply call
the corresponding wcs*() function.

For this to work, wcs*() must _also_ be UTF-32 compatible. We can
check for the presence of the  __STDC_ISO_10646__ macro. If set,
wchar_t is at least 4 bytes and its internal representation is UTF-32.

FreeBSD does *not* define this macro, because its internal wchar_t
representation depends on the current locale. It _does_ use UTF-32
_if_ the current locale is UTF-8.

Since foot enforces UTF-8, we simply need to check if __FreeBSD__ is
defined.

Other fcft API changes:

* fcft_glyph_rasterize() -&gt; fcft_codepoint_rasterize()
* font.space_advance has been removed
* ‘tags’ have been removed from fcft_grapheme_rasterize()
* ‘fcft_log_init()’ removed
* ‘fcft_init()’ and ‘fcft_fini()’ must be explicitly called
</content>
</entry>
<entry>
<title>config: add tweak.grapheme-width-method=max</title>
<updated>2021-11-23T18:50:05Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-11-22T22:02:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=c1c0f11821e36e96add5060916d83533308b4126'/>
<id>urn:sha1:c1c0f11821e36e96add5060916d83533308b4126</id>
<content type='text'>
‘max’ is a new value for ‘tweak.grapheme-width-method’. When enabled,
the width of a grapheme cluster is that of the cluster’s widest
codepoint.
</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>vt: add some unit tests for action_collect()</title>
<updated>2021-07-02T07:46:28Z</updated>
<author>
<name>Craig Barnes</name>
<email>craigbarnes@protonmail.com</email>
</author>
<published>2021-07-02T07:36:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=b18d3aef17b59c97fd0dcdb881bfd88c36341571'/>
<id>urn:sha1:b18d3aef17b59c97fd0dcdb881bfd88c36341571</id>
<content type='text'>
</content>
</entry>
<entry>
<title>config: rename at-most-2 (value for grapheme-width-method) to double-width</title>
<updated>2021-07-01T06:00:23Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-07-01T06:00:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=5138f022146e447d8bb0be56a06e9065b35b6489'/>
<id>urn:sha1:5138f022146e447d8bb0be56a06e9065b35b6489</id>
<content type='text'>
</content>
</entry>
<entry>
<title>config: add tweak.grapheme-width-method=wcswidth|at-most-2</title>
<updated>2021-07-01T05:58:06Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-06-30T16:00:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=9817e44c325f5d44f64bfa768107998134ea7f59'/>
<id>urn:sha1:9817e44c325f5d44f64bfa768107998134ea7f59</id>
<content type='text'>
</content>
</entry>
<entry>
<title>vt: limit grapheme width to 2 cells</title>
<updated>2021-07-01T05:57:56Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-06-29T16:45:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=031e8f59877f4ad25a5a4116342d66f9aac56c20'/>
<id>urn:sha1:031e8f59877f4ad25a5a4116342d66f9aac56c20</id>
<content type='text'>
All emoji graphemes are double-width. Foot doesn’t support non-latin
scripts. Ergo, this should result in the Right Thing, even though
we’re not doing it the Right Way.

Note that we’re now breaking cursor synchronization with nearly all
applications.

But the way I see it, the applications need to be
updated.
</content>
</entry>
<entry>
<title>vt: don’t reset utf8proc grapheme state when we’re not at a grapheme break</title>
<updated>2021-06-25T18:42:23Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-06-25T18:42:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=0ff8f72a9d653269dd6127cc66322690c8a4b90f'/>
<id>urn:sha1:0ff8f72a9d653269dd6127cc66322690c8a4b90f</id>
<content type='text'>
</content>
</entry>
<entry>
<title>vt: utf8: rotate instead of just shifting when updating compose key</title>
<updated>2021-06-24T17:36:39Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-06-24T17:36:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=3bad062f8a8f73b9271d42cc00b7c8a74fa82617'/>
<id>urn:sha1:3bad062f8a8f73b9271d42cc00b7c8a74fa82617</id>
<content type='text'>
This reduces the number of collisions in even more workloads.
</content>
</entry>
<entry>
<title>vt: improved key hash algorithm -&gt; reduces number of key collisions</title>
<updated>2021-06-24T17:18:06Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-06-24T17:18:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=88ce0e437518eee07de99ac51474e03e897bf287'/>
<id>urn:sha1:88ce0e437518eee07de99ac51474e03e897bf287</id>
<content type='text'>
</content>
</entry>
<entry>
<title>composed: insert: require key to be unique</title>
<updated>2021-06-24T17:12:25Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-06-24T17:12:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=f20956ff1bdfb266ae9c690bd2961acf7b3f4845'/>
<id>urn:sha1:f20956ff1bdfb266ae9c690bd2961acf7b3f4845</id>
<content type='text'>
</content>
</entry>
</feed>
