2695 Commits

Author SHA1 Message Date
Mitchell Hashimoto
9e27dcdec9 font: shaper doesn't split run on selection if selection splits grapheme 2023-08-15 15:32:10 -07:00
Mitchell Hashimoto
c8d1745791 terminal: selection string must include grapheme data 2023-08-15 14:55:43 -07:00
Mitchell Hashimoto
67fb8d9bd4 terminal: do not crash if selecting a wide spacer on a soft-wrapped line 2023-08-15 14:38:13 -07:00
Mitchell Hashimoto
6a4b25714a terminal: add a test to verify our grapheme state is what we expect 2023-08-15 13:55:35 -07:00
Mitchell Hashimoto
ab68569281 renderer/opengl: fix compilation for new modes style 2023-08-15 13:33:06 -07:00
Mitchell Hashimoto
d0bf6a914f termio: on restore mode we need to call setMode no matter what 2023-08-15 11:47:31 -07:00
Mitchell Hashimoto
06f82ad713 terminal: parse and handle save/restore mode (CSI ? s, CSI ? r) 2023-08-15 11:43:07 -07:00
Mitchell Hashimoto
951aa00c63 terminal: move to new modes struct 2023-08-15 11:30:33 -07:00
Mitchell Hashimoto
c5439ca516 Merge pull request #287 from mitchellh/macos-key
apprt/embedded: keycallback should use nomod text to determine key
2023-08-15 11:15:36 -07:00
Mitchell Hashimoto
2b2b23dcf6 apprt/embedded: keycallback should use nomod text to determine key
To determine the logical key that was pressed, we previously just
trusted that the translated text would have the right value. But if
modifiers are pressed, the text may not translate.

For example on macOS, Ctrl+C does not produce any text. As a result, we
would fall back to the physical key. On layouts like Dvorak, the
physical key for "C" is "I". This means "Ctrl+C" sequences weren't
working.

Instead, if there is no text or the text doesn't map to a key, we
translate again using no modifiers to try to get the raw text of the
input and then base the key on that.
2023-08-15 11:13:01 -07:00
Mitchell Hashimoto
716c343f07 terminal: ModeState can save/restore one set of modes 2023-08-15 08:43:25 -07:00
Mitchell Hashimoto
e467a48df0 terminal: working on new modes storage abstraction 2023-08-15 08:43:24 -07:00
Mitchell Hashimoto
d27bc1f0fe termio: send VT220 device attributes on request, add secondary 2023-08-15 08:21:48 -07:00
Mitchell Hashimoto
2e54a825bf modify keys state 2 depends on some scenarios
Trying to port xterms logic...
2023-08-14 21:17:12 -07:00
Mitchell Hashimoto
28ff9118b0 Merge pull request #286 from mitchellh/modify-keys-ctrl
modifyOtherKeys state 2 should send sequences for all chars
2023-08-14 18:18:59 -07:00
Mitchell Hashimoto
a1e70afbb1 modifyOtherKeys state 2 should send sequences for all chars
See:
https://github.com/mitchellh/ghostty/issues/242#issuecomment-1678268533

Quoted:
@hovsater OKAY! I've consulted _the source_, i.e. `xterm`. None of the other reference material was illuminating and there is so much conflicting implementation out there and so very few terminals actually support `modifyOtherKeys`. I believe I've figured it out.

I believe that `C-S-h` is only supported via `modifyOtherKeys` state 2. iTerm emits it for state 1 but I think this is a mistake and I can't get any other terminal to do it, including `xterm`.

Here is my test script on Linux:

```
printf "\x1b[>4;1m" # change to "2" for state 2
showkey -a
```

With state 1, I couldn't get any terminal to output anything for `C-S-h`. **But with state 2, xterm outputs: ** `CSI 27;6;72~`. One thing to note is 72 is `H` (uppercase), so in even this case, iTerm appears to be sending the wrong code or `dte -K` is outputting the wrong case (less likely I think).

When I launch `dte` (the full editor), it only requests `modifyOtherKeys` state 1. So, with only `modifyOtherKeys` support, it shouldn't get access to `C-S-h`.

Note that I couldn't get any terminal on macOS to show the same sequences as xterm under any circumstance. I also cracked open the `xterm` source and I only eyeballed it but I believe this is not sending the sequences under state 1: https://sourcegraph.com/github.com/ThomasDickey/xterm-snapshots@c2b36af8d216926b8931c6f9cebefd69228e437c/-/blob/input.c?L579

**I could be very wrong, I'm not confident.** Every implementation (and there are only few) seems different and the behaviors are not consistent at all. Hence, I'm falling back to `xterm`, but even then I could be reading the source wrong. But when I ran `xterm` manually I could only get `C-S-h` to show up in state 2.
2023-08-14 17:53:20 -07:00
Mitchell Hashimoto
9d89c56bfc Merge pull request #285 from mitchellh/left-right-alt
macos: option-as-alt can specify left or right option key
2023-08-14 13:20:46 -07:00
Mitchell Hashimoto
cbd6a325e9 config: macos-option-as-alt now accepts "left", "right" 2023-08-14 12:50:21 -07:00
Mitchell Hashimoto
721087be76 macos: send the left/right status of modifier keys 2023-08-14 12:40:48 -07:00
Mitchell Hashimoto
e7bb9c60b2 input: expand Mods size, convert everything to use it 2023-08-14 12:31:16 -07:00
Mitchell Hashimoto
3556cf8407 input: unify binding-sensitive mods to a single func 2023-08-14 11:51:10 -07:00
Mitchell Hashimoto
2e69b22fcf Merge pull request #282 from mitchellh/kitty-keys
Many keyboard input improvements (no Kitty protocol yet)
2023-08-13 16:30:25 -07:00
Mitchell Hashimoto
49a9d626ec apprt/gtk: convert keyval to unicode if input method doesn't process
See comment for details.
2023-08-13 16:27:46 -07:00
Mitchell Hashimoto
a2310afa4e terminal: ignore ESC \ which enables ST mode since we're always in it 2023-08-13 15:52:38 -07:00
Mitchell Hashimoto
aec342918b input: various more helpers 2023-08-13 15:38:30 -07:00
Mitchell Hashimoto
cea6f5f51d terminal: parse mode 1039 2023-08-13 15:15:11 -07:00
Mitchell Hashimoto
6fb9a113c1 apprt/glfw: send mods to charcallback 2023-08-13 15:12:25 -07:00
Mitchell Hashimoto
4a384aa272 parse and respect mode 1036 2023-08-13 15:12:13 -07:00
Mitchell Hashimoto
2ed6e6a40a config: remove pc style function keys, handled separately now 2023-08-13 14:55:32 -07:00
Mitchell Hashimoto
77df7a0e7f terminal: support disable modify key format sequence ESC[>n 2023-08-13 14:55:32 -07:00
Mitchell Hashimoto
66aa1d9be3 terminal: parse and handle set modify key format (ESC[>{a};{b}m) 2023-08-13 14:55:32 -07:00
Mitchell Hashimoto
d94474463b terminal: handle set application keypad mode (both ESC and modes) 2023-08-13 14:55:32 -07:00
Mitchell Hashimoto
c0736676ce core: match and emit function keys 2023-08-13 14:55:32 -07:00
Mitchell Hashimoto
23f6f950b9 input: add all the mappings for pc style function keys
Not hooked up yet.
2023-08-13 14:55:31 -07:00
Mitchell Hashimoto
5e2fa50d0b macos-option-as-alt config, handle alt-prefix for charCallback 2023-08-13 14:55:31 -07:00
Mitchell Hashimoto
c964a3f4c8 core: translate alt- prefix to an esc (0x1B) prefix 2023-08-13 14:55:31 -07:00
Mitchell Hashimoto
387c62d226 add more ctrl key sequencs for legacy ascii 2023-08-13 14:55:29 -07:00
Mitchell Hashimoto
32993ff3e6 Merge pull request #280 from mitchellh/gtk-inherit
apprt/gtk: inherit font size on new windows and tabs
2023-08-13 12:37:00 -07:00
Mitchell Hashimoto
acb2d882e5 Merge pull request #279 from mitchellh/nix-update
update to nix 23.05
2023-08-13 12:16:41 -07:00
Mitchell Hashimoto
81995fc078 apprt/gtk: inherit font size on new windows and tabs 2023-08-13 12:15:42 -07:00
Mitchell Hashimoto
cec58ae6b5 Merge pull request #278 from mitchellh/fc-retry
only the app should own the font discovery instance
2023-08-13 11:59:12 -07:00
Mitchell Hashimoto
b18e7393e1 build: remove hardcoded glibc, I don't think this error is happening 2023-08-13 11:57:43 -07:00
Mitchell Hashimoto
2df7789f3e update to nix 23.05 2023-08-13 11:53:23 -07:00
Mitchell Hashimoto
0af6edc25b only the app should own the font discovery instance 2023-08-13 11:51:24 -07:00
Mitchell Hashimoto
bddf24f378 Merge pull request #275 from mitchellh/fc-init-once
only initialize font discovery mechanism once, cache on App
2023-08-13 08:19:13 -07:00
Mitchell Hashimoto
619d2ade3e only initialize font discovery mechanism once, cache on App
Fontconfig in particular appears unsafe to initialize multiple times.

Font discovery is a singleton object in an application and only ever
accessed from the main thread so we can work around this by only
initializing and caching the font discovery mechanism exactly once on
the app singleton.
2023-08-13 08:01:33 -07:00
Mitchell Hashimoto
a8426a90dd input: carbon modifier bits were not correct for some modifiers
I went and downloaded a couple different programs that use
UCKeyTranslate and dumped their values since I cannot find the header
file and then wrote a unit test to make sure we stay accurate here.
2023-08-12 15:32:18 -07:00
Mitchell Hashimoto
923df53825 ci: use custom token for release so it isn't rate limited 2023-08-12 11:41:22 -07:00
Mitchell Hashimoto
63fa34ef6b terminal: avoid underflow on resize, tests added 2023-08-12 11:30:07 -07:00
Mitchell Hashimoto
6fec9f8096 Merge pull request #273 from mitchellh/wide-resize
Fix numerous edge cases with resizing columns with soft-wrapped wide characters (i.e. emoji)
2023-08-12 10:31:56 -07:00