summaryrefslogtreecommitdiff
path: root/src/Terminal.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 14:16:32 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commite373dea7e32ab83e37c9db97ef5709786b9b2188 (patch)
tree66ef120faa5571ea7c09345c1841d6877da40c73 /src/Terminal.zig
parent1f929613ad10a525fc2c63d399eda9b2827e1bae (diff)
downloadpardes-e373dea7e32ab83e37c9db97ef5709786b9b2188.tar.gz
pardes-e373dea7e32ab83e37c9db97ef5709786b9b2188.zip
A modifier or function key alone types nothing into a terminal pane
Diffstat (limited to 'src/Terminal.zig')
-rw-r--r--src/Terminal.zig6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Terminal.zig b/src/Terminal.zig
index 32595d25..a32819c3 100644
--- a/src/Terminal.zig
+++ b/src/Terminal.zig
@@ -1131,7 +1131,11 @@ pub fn forwardKey(p: *Pardes, id: usize, key: Key) void {
};
var utf8: [4]u8 = undefined;
const text_cp = if (key.shift and key.cp >= 'a' and key.cp <= 'z') key.cp - 'a' + 'A' else key.cp;
- const text = if (key.text.len > 0) key.text else if (key.cp >= 32 and key.cp < Key.up and key.cp != Key.backspace)
+ // A key with no text of its own types its code point only when that
+ // is a character: the kitty keyboard protocol numbers function and
+ // modifier keys in the private use area (F3 is U+E016), and a shell
+ // was typed those as junk.
+ const text = if (key.text.len > 0) key.text else if (key.cp >= 32 and key.cp < Key.up and key.cp != Key.backspace and !(key.cp >= 0xE000 and key.cp <= 0xF8FF))
utf8[0 .. std.unicode.utf8Encode(text_cp, &utf8) catch return]
else
"";