382 Commits

Author SHA1 Message Date
Mitchell Hashimoto
a67d90710c input: kitty encoding should ignore committed preedit state
Fixes #952
2023-11-24 07:58:31 -08:00
Mitchell Hashimoto
cb0cfab438 comments 2023-11-17 21:37:37 -08:00
Raiden1411
e3b83249d6 core: implement select all binding 2023-11-17 18:01:39 +00:00
Mitchell Hashimoto
4cff8d972c input: do not encode enter with utf8 as pc style key
If the enter key has utf-8 attach, we assume its a dead key state being
committed so we don't process it.
2023-11-15 08:58:12 -08:00
Mitchell Hashimoto
35e78939e5 macos: ignore alt key with other modifiers set
This enables shifted alt-prefixed keys, such as `shift+alt+.` on
US standard becoming `M->`. To do this, we needed to fix a few bugs:

  (1) translation mods should strip alt even if other mods are set
  (2) AppKit translation event needs to construct new characters with
      the translation mods.
  (3) Alt-prefix handling in KeyEncoder needs to allow ASCII utf8
      translations even for macOS.
2023-11-13 19:21:51 -08:00
Mitchell Hashimoto
63e106390f input: fix failing test on Linux 2023-11-13 13:58:41 -08:00
Mitchell Hashimoto
b4d393fdcf input: process alt-prefix even if utf8 text doesn't exist 2023-11-13 13:50:00 -08:00
Mitchell Hashimoto
5001e2c60c macos: filter option in AppKit when option-as-alt set
Fixes #872

In #867 we fixed macos-option-as-alt, but unfortunately AppKit ALSO does
some translation so some behaviors were not working correctly.
Specifically, when you had macos-option-as-alt set, option+e would
properly send `esc+e` to the pty but it would ALSO set the dead key
state for "`" since AppKit was still translating the option key.

This commit introduces a function to strip alt when necessary from the
translation modifiers used at the AppKit layer, preventing this
behavior.
2023-11-13 13:26:37 -08:00
Mitchell Hashimoto
86fbc6a85b macos-option-as-alt works again
This regressed sometime -- I can't find the exact commit -- but in any
case I've moved this handling directly into the KeyEncoder so we can
unit test it and prevent future regressions.
2023-11-12 15:26:55 -08:00
Gregory Anders
cd01340cce macos: add key binding for equalizing split sizes 2023-11-07 16:23:28 -06:00
Mitchell Hashimoto
0ec225683e input: allow modifier aliases
Fixes #824
2023-11-06 11:42:51 -08:00
Mitchell Hashimoto
7be5eba9cb input: unit tests for pasing tuples 2023-11-06 09:23:24 -08:00
Mitchell Hashimoto
1ff81682f7 input: add format support for tuple args 2023-11-06 09:19:59 -08:00
Gregory Anders
0a2d435481 core: add resize_split binding with default keys
On macOS, use Cmd+Ctrl+Arrow keys as default bindings for resizing by 10
points in the given direction.
2023-11-05 20:20:39 -06:00
Gregory Anders
e7745dc820 core: add support for bindings with multiple parameters
This commit adds support for bindings with multiple parameters. For
example, a "resize_split" binding will have two parameters: the resize
direction and the resize amount. Multiple parameters are supported by
using a tuple as the enum value and are written in string form by
separating each argument with a comma. Example: "resize_split:up,10".
2023-11-05 20:20:39 -06:00
Mitchell Hashimoto
debeba99db input: Binding.Trigger format 2023-11-03 17:48:19 -07:00
Mitchell Hashimoto
cb4bb8aaf6 input: add Binding.Action.format to convert action to string 2023-11-03 15:57:14 -07:00
Leo Razoumov
dc527bd2cb feat: keybind escape sequence action "esc:text" similar to "csi:text" 2023-11-02 17:50:17 -04:00
Mitchell Hashimoto
29bbcbbf92 core: add input binding to control terminal inspector 2023-10-24 15:27:14 -07:00
Mitchell Hashimoto
d50ff6ece7 macos: complete cimgui events 2023-10-24 15:27:14 -07:00
Mitchell Hashimoto
879bdf27a9 core: scroll viewport back to bottom on any key input that isn't a mod
Fixes #619

This changes the behavior from requiring printable text to any input
that isn't a modifier and also generates some data we send to the pty.
If there is printable text, we also clear the selection.
2023-10-15 08:53:38 -07:00
Mitchell Hashimoto
d97e5b9dab input: legacy encoding pc style keys should ignore directional modifiers 2023-10-12 12:28:26 -07:00
Mitchell Hashimoto
47ee1e7355 input: Binding string can be unconsumed with "unconsumed:" prefix 2023-09-29 21:34:23 -07:00
Mitchell Hashimoto
9d0e7ab138 input: binding set can track unconsumed triggers 2023-09-29 20:18:41 -07:00
Mitchell Hashimoto
ecb1d19890 input: fix regression with ascii mapping to a keypad key 2023-09-29 20:00:50 -07:00
Mitchell Hashimoto
7bbe669641 Merge pull request #578 from rockorager/dev
Kitty keyboard improvements
2023-09-29 11:56:34 -07:00
Mitchell Hashimoto
a2e2889f2b input: make Key ascii functions comptime-generated 2023-09-29 11:54:05 -07:00
Tim Culverhouse
11cb6824cd input: don't ESC prefix non-ascii characters
User input withe Alt modifier is typically ESC prefixed. Escape
prefixing a non-ascii character can cause bugs in some applications. For
example in bash, emitting an Alt+ф allows the user to backspace one
character into the prompt. This can be repeated multiple times.

When a character is outside the ASCII range (exclusive of 0x7F, this is
handled as a control sequence), print the character as is, with no
prefix.
2023-09-29 08:35:21 -07:00
Tim Culverhouse
fb649e689d input(kitty): fix reporting of alternate keys
Fix reporting of alternate keys when using the kitty protocol. Alternate
keyboard layouts were failing to report the "base layout" key. This
implementation now matches kitty's output 1:1, and has some added unit
tests for cyrillic characters.

This also fixes a bug where a caps_lock modified key would report the
shifted key as well. The protocol explicitly requires that shifted keys
are only reported if the shift modifier is true.
2023-09-29 06:37:08 -05:00
Mitchell Hashimoto
35a4427f54 input: 0x7F is a control character, use helper
Fixes #556

One check for control chars was missing 0x7F. Since we do this three
times, extract it to a helper and call that.
2023-09-27 07:57:21 -07:00
Mitchell Hashimoto
510f0fe8f2 apprt/embedded: if a physical key input is a keypad key, keep it 2023-09-22 11:44:18 -07:00
Mitchell Hashimoto
9ad27924a6 input: correct xterm encoding for modified F1-F4
Fixes #499
2023-09-20 14:33:55 -07:00
Mitchell Hashimoto
ff74f27b99 macos: send caps lock state to UCKeyTranslate 2023-09-19 15:42:36 -07:00
Mitchell Hashimoto
62a35417ab input: kitty alternates and text should not include control characters 2023-09-19 15:18:00 -07:00
Mitchell Hashimoto
58a43f1980 config: store some basic errors on parse 2023-09-11 09:10:26 -07:00
Mitchell Hashimoto
4570356e57 turn zoom into a toggle rather than an explicit zoom/unzoom 2023-09-02 16:03:51 -07:00
Mitchell Hashimoto
519a97b782 core: add unzoom_split binding 2023-09-02 15:15:12 -07:00
Mitchell Hashimoto
50a1a52ae3 core: add zoom keybinding for splits 2023-09-02 14:52:43 -07:00
Mitchell Hashimoto
67bc9f59ed input: kitty keymap was missing page up/down 2023-08-31 14:32:42 -07:00
Mitchell Hashimoto
369ffebb72 input: when overwriting a binding, we must update the reverse map 2023-08-31 13:08:33 -07:00
Mitchell Hashimoto
fe5da86bb0 input: maintain a reverse mapping to quickly look up trigger by action 2023-08-31 12:45:43 -07:00
Mitchell Hashimoto
ba883ce39a add ghostty_config_trigger C API to find a trigger for an action 2023-08-30 22:14:44 -07:00
Mitchell Hashimoto
17e46bf0f4 input: move action parsing to dedicating Action.parse 2023-08-30 21:39:25 -07:00
Mitchell Hashimoto
39c2332d35 input: keypad enter should act as normal "\r" if no other seq matches
This matches Kitty behavior on both macOS and Linux. In certain keyboard
modes and Kitty keyboard modes, the behavior changes but those already
matched (tested).
2023-08-26 07:43:22 -07:00
Mitchell Hashimoto
e7c11f7d13 input: kitty should not encode modifier-only key unless "report all" 2023-08-24 21:24:41 -07:00
Mitchell Hashimoto
3a93aaf9cf apprt/embedded: do not translate control characters
macOS translates inputs such as shift+tab into the control character tab
(ascii 0x09). Linux/GTK does not translate character inputs except to
printable characters. We don't want control character translations
because these are all handled manually by our key encoder (i.e.
translating ctrl+c to 0x03).
2023-08-24 15:01:57 -07:00
Mitchell Hashimoto
5e45dc3386 input: kitty encoding should only output unmodified utf8 if printable 2023-08-22 15:00:53 -07:00
Mitchell Hashimoto
99abff85dd input: pc style function keys should use all mods, not effective 2023-08-21 08:10:27 -07:00
Mitchell Hashimoto
7ccf86b175 remove imgui and devmode
imgui has been a source of compilation challenges (our fault not theirs)
and devmode hasn't worked in awhile, so drop it.
2023-08-20 08:50:24 -07:00
Thorsten Ball
2e9b787668 macOS: new window can inherit font size
This is the second part of #281 and adds the same mechanism that was
added for tabs in #296 for windows.

It works exactly the same way.
2023-08-19 09:29:56 +02:00