382 Commits

Author SHA1 Message Date
Mitchell Hashimoto
2da2cee704 input: remove the old parse method for bindings 2024-08-18 20:58:35 -07:00
Mitchell Hashimoto
9944f5d34d input: Binding.Set.clone handles leaders 2024-08-18 20:30:32 -07:00
Mitchell Hashimoto
bfb31c374e input: binding set needs to clean up leader memory on manual put 2024-08-18 20:30:32 -07:00
Mitchell Hashimoto
39d91741e0 input: remove todo 2024-08-18 20:30:32 -07:00
Mitchell Hashimoto
2f71eb6f99 input: unwind properly on unbind 2024-08-18 20:30:32 -07:00
Mitchell Hashimoto
64a68eeaff input: more parseAndPut tests 2024-08-18 20:30:32 -07:00
Mitchell Hashimoto
c71615c467 input: binding.set can parse sequences... lots TODO 2024-08-18 20:30:32 -07:00
Mitchell Hashimoto
7dfad49e40 input: converting set entries to Entry from Action 2024-08-18 20:30:32 -07:00
Mitchell Hashimoto
bc4eab4af7 input: add Set.parseAndPut 2024-08-18 20:30:32 -07:00
Mitchell Hashimoto
a798a26063 input: binding parser of sequences 2024-08-18 20:30:32 -07:00
Mitchell Hashimoto
e2913fd16f input: SequenceIterator to parse sequences of triggers 2024-08-18 20:30:32 -07:00
Mitchell Hashimoto
63ec5cdd9d input: Trigger.parse 2024-08-18 20:30:32 -07:00
Mitchell Hashimoto
6a44d3196d input: yeet usingnamespace 2024-08-16 10:16:46 -07:00
Mitchell Hashimoto
64c267a8c7 Merge pull request #2052 from rockorager/pretty-print
cli/list-keybinds: add pretty printing
2024-08-06 14:53:15 -07:00
Tim Culverhouse
59e226154c cli/list-keybinds: add pretty printing
Add pretty printing to the +list-keybinds command. This is done by
bringing in a dependency on libvaxis to handle the styling. Pretty
printing happens automatically when printing to a tty, and can be
disabled either by redirecting output or using the flag `--plain`
2024-08-06 12:19:39 -05:00
Łukasz Niemier
f9be02a20f chore: clean up typos 2024-08-05 13:56:57 +02:00
Mitchell Hashimoto
a75ee29f2d Merge pull request #1981 from injust/adjust-line
Add `adjust_selection` actions for `beginning_of_line` and `end_of_line`
2024-07-22 09:40:45 -07:00
multifred
72c672adb7 Fix multiple deprecated names for zig lib/std 2024-07-22 00:07:17 +02:00
Justin Su
97bd46de7f Add adjust_selection actions for beginning_of_line and end_of_line 2024-07-20 23:06:47 -04:00
Mitchell Hashimoto
a62b76eda3 core: add binding to write screen to file 2024-07-19 20:24:51 -07:00
Mitchell Hashimoto
55657465a7 add write_selection_file
Based on the work by @gigamaax
2024-07-19 20:20:49 -07:00
Mitchell Hashimoto
e3df08039a some bikeshedding 2024-07-19 20:03:20 -07:00
karei
6fde429728 core: support opening scrollback file in default text editor 2024-07-19 19:56:00 -07:00
Mitchell Hashimoto
72c0f9dd32 adjust selection 2024-07-19 14:20:28 -07:00
Mitchell Hashimoto
72d8af5d0b rename to expand_selection 2024-07-19 14:19:21 -07:00
Cameron Dart
cdeeeb9f88 feat: keybinds for text selection on copy mode 2024-07-19 14:08:52 -07:00
Mitchell Hashimoto
2d7baaa7d7 apprt/gtk: toggle_window_decorations keybinding
Fixes #1943
2024-07-15 21:23:52 -07:00
Mitchell Hashimoto
f8fe0445a5 core: clicking OSC8 links work 2024-07-05 21:40:39 -07:00
Mitchell Hashimoto
6faeb9ba40 core: mouse pressure state and callbacks 2024-06-29 10:42:45 -05:00
Gordon Cassie
c967a35abb Fix some basic build errors. 2024-06-24 15:16:24 -07:00
Mitchell Hashimoto
1fae17d1ef input: CSIu should send full codepoint
Related to #1802

CSIu format sends a unicode codepoint but we were just sending the first
byte of the utf8 sequence, which is very much not right. This fixes that
by parsing the utf-8.

It isn't defined what to do if the utf-8 sequence is invalid or has
multiple codepoints so we just skip CSIu encoding in that case.
2024-06-02 14:38:13 -07:00
Mitchell Hashimoto
1551c27578 input: Kitty alternate should be reported even if no shifted text (#1817)
Reproduction: HU layout Ctrl+ő

On release, we were previously not sending an alt text (we were sending
it properly on press). Kitty sends it also on release and the spec makes
it clear we should send it on release. This was just due to some faulty
logic; added a test and fixed that.
2024-06-02 14:36:08 -07:00
Mitchell Hashimoto
14417d2592 Allow keybinding arbitrary unicode codepoints (#1814)
Fixes #1802 

This allows `keybind` configurations to map to any Unicode codepoint. This enables keybindings for which we don't have a registered keycode or for custom keyboard firmwares that may produce arbitrary text (but the Ghostty support is limited to a single codepoint).

The `keybind` syntax is unchanged. If a bound character doesn't map to a known logical key that Ghostty knows about, we map it to a Unicode codepoint. The unicode codepoint is compared against the _unshifted codepoint_ from the apprt key event. 

Note that this binding is to a single _codepoint_. We don't support arbitrary sequences of characters or multi-code point graphemes for keybindings due to the complexity in memory management that would introduce.

This also provides a good fallback for scenarios where it might make sense to educate Ghostty about a key code or fix a bug in our keyboard input system, but the unicode data is correct. In that scenario, unicode key binds should allow key binds to still work while we investigate the input issues.

Example:

```
shift+ö=text:hello
```

This now works as expected on a US hardware keyboard with the Hungarian keyboard layout.
2024-06-02 10:53:36 -07:00
Qwerasd
d4a7549222 feat(font): Non-integer point sizes
Allows for high dpi displays to get odd numbered pixel sizes, for
example, 13.5pt @ 2px/pt for 27px font. This implementation performs
all the sizing calculations with f32, rounding to the nearest pixel
size when it comes to rendering. In the future this can be enhanced
by adding fractional scaling to support fractional pixel sizes.
2024-05-09 00:03:40 -04:00
Mitchell Hashimoto
8dbedeb76c fix breaking changes with latest zig 2024-04-17 20:50:50 -07:00
Mitchell Hashimoto
fc4284e406 input: Key.Side needs a specific backing int for use in packed 2024-04-17 20:50:50 -07:00
Mitchell Hashimoto
026484fea6 fix more comptime var leaks 2024-04-17 20:50:50 -07:00
rok
df9b8f1fbc input: fix bs emitting sequence when it should not
In korean input method on macos, it should simply return empty string.
Issue was created after https://github.com/mitchellh/ghostty/pull/1659.

```
gksr<BS> # 한ㄱ<BS>
```

'ㄱ' at the end should be removed with single <BS>, but for now
it requires two <bs> to remove 'ㄱ'.
2024-04-08 22:11:01 +09:00
Mitchell Hashimoto
91ba47af1f input: add test for backspace change 2024-04-05 08:25:14 -07:00
rok
51bfde69ba input: do not emit sequence on <BS> when their's UTF-8 text 2024-04-05 19:55:17 +09:00
Mitchell Hashimoto
0bd673435f input: add test for esc clearing dead key state 2024-04-04 21:57:32 -07:00
rok
9326ae363c input: escape can be used to clear dead key state
This fixes korean input method issue on mac. When typing korean
and press escape in vim, composing korean character should remain.
2024-04-05 03:17:39 +09:00
Mitchell Hashimoto
461b16ce34 font sizes are limited to u8 (max size = 255 points)
Fixes #1618

Font sizes in configuration were always a u8, but the keybinding and
internal state was a u16 so it allowed for an ever-growing font size. At
a certain point, there is an integer overflow which causes it to wrap
around. This is all silly, 255 should be large enough for anyone[1]

[1]: Ready to be super wrong about this
2024-03-27 20:36:59 -07:00
Gregory Anders
c634ba363a input: fix associated text on macOS
Ghostty does not report associated text on macOS when
macos-option-as-alt is enabled for _any_ key press, whether or not the
Alt modifier is actually present. The "option as alt" decision should
only be made when the alt modifier is present.
2024-03-25 13:43:32 -05:00
ProfOak
96daf97d19 Add keybind support for shift+insert selection paste 2024-02-21 19:33:05 -06:00
Gregory Anders
cff9671bdf Omit release events for backspace, enter, and tab if report_all is unset 2024-02-18 09:43:05 -06:00
Mitchell Hashimoto
1170cee550 input: encode ctrl+shift+<ascii letter> in CSIu as lowercase + shift
This follows a specific behavior Kitty has, but no other terminal seems
to have, but it is a reasonable behavior that is in use by real programs
as found by our beta testing community.

We diverge from Kitty though in that we only apply this to ASCII
letters. Kitty does not CSIu encode special characters like `@` or `$`.
For these characters, Ghostty still encodes it as specified by fixterms.
2024-02-17 13:45:49 -08:00
Mitchell Hashimoto
4a6ba59f73 input: send shifted uppercase ASCII letters as CSIu
Related to #1507

The comments in this change have most of the detail. The primary gist:

  - caps-lock is handled correctly so #1501 is still fixed
  - only characters pressed with the shift key are affected
2024-02-17 08:39:27 -08:00
Mitchell Hashimoto
2f36fd4b5f input: ctrl ASCII uppercase behaves the same as ctrl lowercase
Fixes #1505

I verified this behavior with every other terminal and I've added test
cases for it. We previously had a test case to assert the opposite,
which is incorrect.
2024-02-11 14:28:53 -08:00
Mitchell Hashimoto
f414787779 move SplitDirection to apprt 2024-02-04 20:42:42 -08:00