input: (kitty kbd): the resulting UTF-8 string may translate to multiple UTF-32 codepoints

When this happened (for example, by specifying a custom compose
sequence), the kitty keyboard protocol didn’t emit any text at all.

This was caused by the utf32 codepoint being -1. This in turned was
caused by us trying to convert the utf8 sequence to a *single* utf32
codepoint.

This patch replaces the use of mbrtoc32() with a call to
ambstoc32(), and the utf32 codepoint with an utf32 string.

The kitty keyboard protocol is updated:

* When determining if we’re dealing with text, check *all* codepoints
  in the utf32 string.

* Add support for multiple codepoints when reporting "associated
  text". The first codepoint is the actual parameter in the emitted
  sequence, and the remaining codepoints are sub-parameters. I.e. the
  codepoints are colon separated.

Closes #1288
This commit is contained in:
Daniel Eklöf 2023-03-27 16:56:10 +02:00
parent ae26915916
commit 3215d54f31
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 32 additions and 12 deletions

View file

@ -134,6 +134,8 @@
* `xdg\_toplevel::set_min_size()` not being called.
* Key bindings with consumed modifiers masking other key bindings
([#1280][1280]).
* Multi-character compose sequences with the kitty keyboard protocol
([#1288][1288]).
[1173]: https://codeberg.org/dnkl/foot/issues/1173
[1190]: https://codeberg.org/dnkl/foot/issues/1190
@ -144,6 +146,7 @@
[1256]: https://codeberg.org/dnkl/foot/issues/1256
[1249]: https://codeberg.org/dnkl/foot/issues/1249
[1280]: https://codeberg.org/dnkl/foot/issues/1280
[1288]: https://codeberg.org/dnkl/foot/issues/1288
### Security