4478 Commits

Author SHA1 Message Date
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
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
cbd6a325e9 config: macos-option-as-alt now accepts "left", "right" 2023-08-14 12:50:21 -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
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
81995fc078 apprt/gtk: inherit font size on new windows and tabs 2023-08-13 12:15:42 -07:00
Mitchell Hashimoto
0af6edc25b only the app should own the font discovery instance 2023-08-13 11:51:24 -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
63fa34ef6b terminal: avoid underflow on resize, tests added 2023-08-12 11:30:07 -07:00
Mitchell Hashimoto
9b5fd4b2ee terminal: print wide char with 1-col width 2023-08-12 10:27:42 -07:00
Mitchell Hashimoto
71c8d5fc8e terminal: resizing to 1 col wide with wide chars 2023-08-12 10:23:06 -07:00
Mitchell Hashimoto
44dd51a5b9 terminal: less col resizing with wide char needs to insert head spacer 2023-08-12 10:07:13 -07:00
Mitchell Hashimoto
eb10e9642c terminal: introduce wide spacer head if reflowing wide char w/ more cols 2023-08-12 09:51:33 -07:00
Mitchell Hashimoto
3d5eda62fe terminal: resize more cols with wide spacer head across multiple lines 2023-08-12 08:26:13 -07:00
Mitchell Hashimoto
a6af75aee4 terminal: resize more cols with wide spacer head deletes the spacer 2023-08-12 08:20:10 -07:00
Mitchell Hashimoto
3d72178ef4 terminal: delete wide char if it wraps and we delete the row above 2023-08-11 16:23:02 -07:00
Mitchell Hashimoto
8bb69045a8 terminal: allow selections outside of written area and clamp
This fixes a possible crash.
2023-08-11 14:21:07 -07:00
Mitchell Hashimoto
55778a049b apprt/gtk, opengl: render preedit 2023-08-11 12:37:27 -07:00
Mitchell Hashimoto
d62161e2c3 support preedit text rendering in core and metal 2023-08-11 12:20:48 -07:00
Mitchell Hashimoto
65c4aada02 input: rename "unmapped" to "physical" 2023-08-11 12:02:01 -07:00
Mitchell Hashimoto
57f7a59168 input: rename Keymap to KeymapDarwin since its macos only for now 2023-08-11 12:02:01 -07:00
Mitchell Hashimoto
ce4eb2112c core: get rid of ignore_char, apprt must handle this now 2023-08-11 12:02:01 -07:00
Mitchell Hashimoto
38477ed547 apprt/gtk: use manual translation, handle dead key states 2023-08-11 12:02:01 -07:00
Mitchell Hashimoto
e787a79702 input: printable, comment on what magic indexes mean 2023-08-11 12:02:01 -07:00
Mitchell Hashimoto
1ded176377 input: only load Keymap on darwin 2023-08-11 12:02:00 -07:00
Mitchell Hashimoto
7ea8feea69 apprt/embedded: fix char callback ignore when key is consumed 2023-08-11 12:02:00 -07:00
Mitchell Hashimoto
4fe739cae0 core: note when keyCallback processed the input 2023-08-11 12:02:00 -07:00
Mitchell Hashimoto
d5df8aea9a apprt/embedded: handle repeat events 2023-08-11 12:02:00 -07:00
Mitchell Hashimoto
d02bf322f8 apprt/embedded: remove old _key api, new only! 2023-08-11 12:02:00 -07:00
Mitchell Hashimoto
1e1ad7deb9 macos: use the new self-hosted translation 2023-08-11 12:02:00 -07:00