<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/foot.git/vt.c, branch 1.26.1</title>
<subtitle>A fast, lightweight and minimalistic Wayland terminal emulator</subtitle>
<id>https://git.0x0f.dev/mirrors/foot.git/atom?h=1.26.1</id>
<link rel='self' href='https://git.0x0f.dev/mirrors/foot.git/atom?h=1.26.1'/>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/'/>
<updated>2025-03-18T17:28:09Z</updated>
<entry>
<title>vt: utf8: insert a REPLACEMENT CHARACTER when an invalid UTF-8 sequence is detected</title>
<updated>2025-03-18T17:28:09Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2025-03-18T17:28:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=a02c0c8d4de96832f2bb3e8c16b8e6e4cf6a9662'/>
<id>urn:sha1:a02c0c8d4de96832f2bb3e8c16b8e6e4cf6a9662</id>
<content type='text'>
</content>
</entry>
<entry>
<title>vt: utf8: don't discard current byte when an invalid UTF-8 sequence is detected</title>
<updated>2025-03-18T13:37:28Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2025-03-18T13:37:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=878e07da59855d62e89eba5f5f479a5ee598998e'/>
<id>urn:sha1:878e07da59855d62e89eba5f5f479a5ee598998e</id>
<content type='text'>
Example:

  printf "pok\xe9mon\n"

would result in 'pokon' - the 'm' has been discarded along with E9.

While correct, in some sense, it's perhaps not intuitive.

This patch changes the VT parser to instead discard everything up to
the invalid byte, but then try the invalid byte from the ground
state. This way, invalid UTF-8 sequences followed by both plain ASCII,
or longer (and valid) UTF-8 sequences are printed as expected instead
of being discarded.
</content>
</entry>
<entry>
<title>term+vt: refactor: move "utf8" char processing to term_process_and_print_non_ascii()</title>
<updated>2025-02-06T06:45:20Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2025-01-26T06:33:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=d3f692990ef66f550bb3a0ade2e84107cfbeca47'/>
<id>urn:sha1:d3f692990ef66f550bb3a0ade2e84107cfbeca47</id>
<content type='text'>
This function "prints" any non-ascii character (i.e. any character
that ends up in the action_utf8_print() function in vt.c) to the
grid. This includes grapheme cluster processing etc.

action_utf8_print() now simply calls this function.

This allows us to re-use the same functionality from other
places (like the text-sizing protocol).
</content>
</entry>
<entry>
<title>composed: refactor: break out lookup with collision detection</title>
<updated>2025-02-06T06:42:37Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2025-01-24T13:15:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=e248e73753d61bfd24f1af8e824231434db63c53'/>
<id>urn:sha1:e248e73753d61bfd24f1af8e824231434db63c53</id>
<content type='text'>
</content>
</entry>
<entry>
<title>composed: re-factor: break out key calculation from vt.c</title>
<updated>2025-02-06T06:42:37Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2025-01-24T08:52:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=1181f74d19f6f9e881b539ed9fdb8cc17d03f7bf'/>
<id>urn:sha1:1181f74d19f6f9e881b539ed9fdb8cc17d03f7bf</id>
<content type='text'>
</content>
</entry>
<entry>
<title>term: insert-mode: handle combining characters correctly</title>
<updated>2025-02-06T06:37:55Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2025-02-06T06:31:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=88dcde3ed8b30c14a5d834d0e88f9b4a5f584939'/>
<id>urn:sha1:88dcde3ed8b30c14a5d834d0e88f9b4a5f584939</id>
<content type='text'>
When the client application emits combining characters, for example
multi-codepoint emojis, in insert-mode, we ended up pushing partial
graphemes to the right, for each codepoint, resulting in too many
cells (and with the wrong content) being inserted.

The fix is fairly simple; don't "insert" when appending characters to
an existing grapheme cluster.

This isn't something we can detect easily in print_insert() (it would
require us to do grapheme clustering again). Fortunately, we do have
the required information in action_utf8_print(). So, pass this
information as a boolean to term_print().

Closes #1947
</content>
</entry>
<entry>
<title>vt: combining chars: ensure 'key' is within range</title>
<updated>2025-01-18T09:22:24Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2025-01-18T09:22:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=22e1b1610f622ca9e2a7e64593025a8d44bc7b14'/>
<id>urn:sha1:22e1b1610f622ca9e2a7e64593025a8d44bc7b14</id>
<content type='text'>
When there's a key collision, we increment the key and check
again. When doing this, we need to ensure the key is withing range,
and wrap around to 0 if the key value is too large.
</content>
</entry>
<entry>
<title>vt: don't call fcft_precompose() if font is NULL</title>
<updated>2024-11-02T19:11:14Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-11-02T19:11:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=b43f19cb50d8f617145ab7825e3df1d6a9ff299c'/>
<id>urn:sha1:b43f19cb50d8f617145ab7825e3df1d6a9ff299c</id>
<content type='text'>
This fixes a crash when doing a partial PGO build (where we don't have
any fonts available).
</content>
</entry>
<entry>
<title>Remove a number of unused includes</title>
<updated>2024-08-02T06:28:13Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-08-01T18:11:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=a9e462d952ca1e0367e9e6eb6ee00a0cda7e8c9b'/>
<id>urn:sha1:a9e462d952ca1e0367e9e6eb6ee00a0cda7e8c9b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>term: performance: use a bitfield to track which ascii printer to use</title>
<updated>2024-06-26T16:39:24Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-06-23T23:26:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=48cf57818d354625fd1820ee82e31b8bb3227202'/>
<id>urn:sha1:48cf57818d354625fd1820ee82e31b8bb3227202</id>
<content type='text'>
The things affecting which ASCII printer we use have grown...

Instead of checking everything inside term_update_ascii_printer(), use
a bitfield.

Anything affecting the printer used, must now set a bit in this
bitfield. This makes term_update_ascii_printer() much faster, since
all it needs to do is check if the bitfield is zero or not.
</content>
</entry>
<entry>
<title>vt: unittest: verify emoji_vs list is sorted</title>
<updated>2024-06-25T06:23:40Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-06-25T06:23:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=7378ecf9a76352b90ddc7bf95a582eb9b124acda'/>
<id>urn:sha1:7378ecf9a76352b90ddc7bf95a582eb9b124acda</id>
<content type='text'>
</content>
</entry>
<entry>
<title>vt: only apply VS-15/16 to valid sequences</title>
<updated>2024-06-25T06:20:21Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-06-24T19:18:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=96656614454f96034d9cc0f0e14c76493b5b7c6b'/>
<id>urn:sha1:96656614454f96034d9cc0f0e14c76493b5b7c6b</id>
<content type='text'>
At compile time, build a lookup table from the Unicode data file
'emoji-variation-sequences.txt'.

At run-time, when we detect a VS-15/16 sequence, do a lookup in this
table, and enforce the variation selector iff the sequence is valid.

Closes #1742
</content>
</entry>
<entry>
<title>vt: don't ignore VS-15 (text presentation)</title>
<updated>2024-06-25T06:20:20Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-06-24T18:21:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=94583703e12fc46a1ca16718a18579f8db2be0f8'/>
<id>urn:sha1:94583703e12fc46a1ca16718a18579f8db2be0f8</id>
<content type='text'>
When we encounter either VS-15 or VS-16, set the grapheme width to 1
or 2 explicitly.
</content>
</entry>
<entry>
<title>vt: DECALN: erase sixels, reset margins, home the cursor</title>
<updated>2024-03-07T15:24:34Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-12-26T15:42:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=60c5d889ecd8b0496e181f587dc2c6368a209b06'/>
<id>urn:sha1:60c5d889ecd8b0496e181f587dc2c6368a209b06</id>
<content type='text'>
https://vt100.net/docs/vt510-rm/DECALN.html:

  Notes on DECALN

  DECALN sets the margins to the extremes of the page, and moves the
  cursor to the home position.
</content>
</entry>
<entry>
<title>vt: update DECALN to use term_fill()</title>
<updated>2024-03-07T15:24:33Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-12-26T15:07:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=74a1fa9e00058589c30454a87b68527fd27ead9b'/>
<id>urn:sha1:74a1fa9e00058589c30454a87b68527fd27ead9b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>vt: ignore VS16 (U+FE0F) when grapheme clustering is disabled</title>
<updated>2024-02-16T06:13:32Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-02-16T06:11:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=0c94bf43f221f81e3aa184d88c31d6dbea1e23f9'/>
<id>urn:sha1:0c94bf43f221f81e3aa184d88c31d6dbea1e23f9</id>
<content type='text'>
This fixes:

a) a compilation error with -Dgrapheme-clustering=disabled

b) ensures U+FE0F does *not* allocate a two cells when grapheme
   clustering has been disabled (either compile time, in config, or
   run-time).
</content>
</entry>
<entry>
<title>vt: VS16 - variation selector 16 (emoji representation) should only affect emojis</title>
<updated>2024-02-15T15:56:30Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-02-08T16:09:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=aca9af020241a4b7e4c172a009bf8d4fcfc4e16b'/>
<id>urn:sha1:aca9af020241a4b7e4c172a009bf8d4fcfc4e16b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Don't use fancy Unicode quotes, stick to ASCII</title>
<updated>2024-02-06T11:36:45Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-02-06T11:36:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=7999975016a57cc0a2c2e20bc55f29de32df7044'/>
<id>urn:sha1:7999975016a57cc0a2c2e20bc55f29de32df7044</id>
<content type='text'>
</content>
</entry>
<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>
</feed>
