1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-10 15:04:32 +03:00
Commit Graph

31 Commits

Author SHA1 Message Date
Wez Furlong
b92f31e7a6 macos: fix CTRL-Backslash on German layouts
refs: https://github.com/wez/wezterm/issues/1891
2022-04-19 14:17:04 -07:00
Wez Furlong
fdb3471017 xkeyboard: resolve ambiguous CTRL-i / CTRL-Tab
We want to avoid normalizing control key presses; there were
two places where it was happening; one in our own code and
the other was in the xkeyboard mapping stuff itself.

refs: https://github.com/wez/wezterm/issues/1851
2022-04-15 07:27:01 -07:00
Wez Furlong
c96396bd2f input: normalize_ctrl shouldn't turn CTRL-Tab into Ctrl-i
I'm not sure that we strictly want/need this normalization function
any more, but I'm hesitant to blanket remove it without having time
to really investigate further.

cc: @CIAvash
2022-04-07 06:47:15 -07:00
Wez Furlong
f34d3a872e keys: fix always parsing key="F" as physical key
When considering "F" we'd try to parse it as "F<NUMBER>" and fail,
so fall back to producing `Physical(F)` instead.

Since this was in the context of CMD-F in the default keymap code,
we'd then generate ctrl-F as an equivalent when considering the
ctrl-shift case.

cc: @CIAvash
2022-04-07 06:39:06 -07:00
Wez Furlong
eefe4bd201 keys: improve key config parsing
The recent switch to DeferredKeyCode introduced a bit of ambiguity
when parsing certain keys.

One issue was with the map that was used for some parsing didn't have
consistent/distinct entries for physical vs. mapped.

Another issue is that the key resolution for the simple case where
a key had the same physical and mapped representations would always
return the mapped one even when physical mode was set as a preference.

This commit kills the ambiguous map in favor of an string conversion
method on KeyCode.

It's possible that this will help with https://github.com/wez/wezterm/issues/1826
a little, but I started looking at this because there were a couple of
comments about Alt-Enter and some numpad keys no longer working in the
Element channel.
2022-04-06 09:50:08 -07:00
Wez Furlong
508baabc79 keys: default assignments can now be set to mapped or physical
A bit of a PITA, this commit:

* Introduces a DeferredKeyCode type that defers resolving a concrete
  keycode
* Adds key_map_preference config which can be Mapped or Physical
* Key map building resolves the keycode using key_map_preference
* Default key assignments have been re-phrased in order to produce
  DeferredKeyCodes
* User-specified keys without `mapped:` or `phys:` prefixes will
  resolve according to key_map_preference

refs: https://github.com/wez/wezterm/issues/1788
refs: https://github.com/wez/wezterm/issues/1784
2022-04-01 08:07:23 -07:00
Greg V
9879005f87 add support for XF86Copy/XF86Paste keys 2022-03-11 06:43:18 -08:00
Wez Furlong
631f7869a5 launcher: consistently order entries 2022-01-16 20:59:51 -07:00
Wez Furlong
4524abcdba gui: revise win32-input-mode flow
We need 100% of the info for it to work correctly, so this commit:

* Exposes the keyboard encoding mode via the Pane trait
* Adds the scan code to the RawKeyEvent
* Has the GUI perform the encoding if the keyboard is set that way
* Removes the basic encoder from termwiz in favor of the gui level one

The net result is that we bypass the Pane::key_up/Pane::key_down methods
in almost all cases when the encoding mode is set to win32-input-mode.

There is now a config option: allow_win32_input_mode that can be
used to prevent using this mode.

refs: #1509
2022-01-07 13:02:09 -07:00
Wez Furlong
94a35c9d1e input: revert 8f8ee4e87e
this makes us consistent in behavior with xterm:

CTRL-H -> 0x08
Backspace -> 0x7f
CTRL-Backspace -> 0x08

refs: #1508
refs: #1495
2022-01-06 12:26:58 -07:00
Wez Furlong
27d452a20f input: route key up events to pane on win32
refs: https://github.com/wez/wezterm/issues/1509
2022-01-06 09:45:51 -07:00
Wez Furlong
e39b0b1b4a input: add VK_MENU -> LeftAlt mapping for windows
refs: https://github.com/wez/wezterm/issues/1509
refs: https://github.com/wez/wezterm/issues/1483
2022-01-06 08:10:14 -07:00
Wez Furlong
9919745d4e launcher: tidy up key/mod display impl to make it look nicer
Make things a little more compact and display friendly

refs: #1485
2022-01-03 23:38:36 -07:00
Wez Furlong
2fc23b7c97 input: add KeyCode number -> phys mapping
refs: https://github.com/wez/wezterm/issues/1483#issuecomment-1004377403
2022-01-03 15:01:34 -07:00
Wez Furlong
83fbba0615 input: define keycode -> phys mapping
refs: #1483
2022-01-03 12:12:10 -07:00
Wez Furlong
8f8ee4e87e input: don't normalize ctrl-backspace to ctrl-h
refs: #1495
2022-01-03 11:28:47 -07:00
Wez Furlong
2890e4e723 keyboard: use more consistent backspace/delete names for physkeycodes
refs: #1495
2022-01-03 11:05:38 -07:00
Wez Furlong
34dd0b6688 add mapping from phys to keycode, tidy up windows event processing
refs: #1483
2022-01-03 10:56:32 -07:00
Wez Furlong
5f26746286 window/gui: remove raw/phys fallback fields from KeyEvent
Since we now have RawKeyEvent and a sane way to indicate handling,
we don't need these any more, and it simplifies key dispatch to
remove them.

refs: #1483
2022-01-03 09:13:55 -07:00
Wez Furlong
d9851e5c2a window: generate RawKeyEvents on X11/Wayland
Similar to d5726ba91a but for X11/Wayland.

Handling a RawKey event cancels any composition or further processing
on the same key.

refs: https://github.com/wez/wezterm/issues/877
2022-01-02 16:14:40 -07:00
Wez Furlong
d5726ba91a window: add RawKeyEvent concept
on macos only (for now), we generate a RawKeyEvent prior to
dead key or IME composition and route it to the window to give it
a chance to handle the event.

RawKeyEvent handling is scoped only to key assignments, not generating
input for the terminal.

A raw key event can be marked as handled to prevent moving on to
performing composition and generating cooked key input.

refs: https://github.com/wez/wezterm/issues/877
2022-01-02 15:04:27 -07:00
Wez Furlong
43d9392c52 window: x11/wayland: extract utf8 version of key from key state
Previously, we'd take a couple of guesses at how to map the key
to a utf8 value, but! the keyboard state has a method that can tell
us what to use.

This is important in non-latin keymaps where, for example, the `c`
key generates cyrillic small letter es and we'd end up sending
CTRL + that through to the terminal when CTRL is held down.

If we get the utf8 string from the keyboard layer then we get
CTRL+c instead, and that is what we want.

refs: https://github.com/wez/wezterm/issues/678
2022-01-02 11:16:52 -07:00
Wez Furlong
30a390053a window: track phys_code on X11/Wayland
We don't do anything useful with it yet

refs: https://github.com/wez/wezterm/issues/1483
2022-01-02 00:47:04 -07:00
Wez Furlong
d714c5d5b6 window: track phys_code on macos
We don't do anything useful with it yet

refs: https://github.com/wez/wezterm/issues/1483
2022-01-01 22:04:59 -07:00
Wez Furlong
b15907f61f input-types: introduce PhysKeyCode type
Based on the mac constants of the equivalent functionality;
may need some tweaking for other OS's.

refs: https://github.com/wez/wezterm/issues/1483
2022-01-01 21:35:37 -07:00
Wez Furlong
f4fab10e69 gui: box model style layout/render for fancy tab bar
This commit adds a CSS box model inspired element / layout
facility, and replaces the hand implemented fancy tab bar
element render.

This makes the code for fancy tab bar much easier to read
and update.

The right status area now expands to the full height of the
tab bar area, and uses a line height of 2.0, which makes
it line up nicely in the tab bar.
2021-12-28 00:14:54 -07:00
Wez Furlong
c4257ab8d6 config: fix asymmetric serialization of keycode and modifiers
This adds string serialization for the keycode and modifiers as
used in the config.

We can't simply tell the base types to serialize in this form because
we may serialize and pass those via the mux protocol and the default
derived serializers are more efficient for that purpose.

This allows:

```lua
local wezterm = require 'wezterm'

return {
  keys = {
    {key="a", mods="ALT", action=wezterm.action{SendKey={key="b"}}}
  },
}
```

to parse: previously, wrapping `SendKey` in `wezterm.action` would fail
to round-trip the the `SendKey` and lead to an error loading the
config.
2021-12-25 12:11:59 -07:00
Wez Furlong
6d9957e6e3 term, gui: allow tracking multiple buttons
We were previously only remembering the most recently pressed
button, but that's a lossy thing to do.

This commit remembers the button presses so that we can correctly
report all press/release events.

refs: #973
2021-08-07 18:37:38 -07:00
Chris
2add312c5c
Allow VoidSymbol keycode to be seen by wezterm (#759)
* allow voidsymbol for key code

* update docs, cleanup

* cleanup and fmt of files

* remove unnecessary inputs
2021-05-07 07:54:24 -07:00
Wez Furlong
1178639a22 windows: implement decoration setting, change to bitfield
Can now set `window_decorations = "TITLE|RESIZE"` or variations
on those flags.  `NONE` is a shortcut for no flags.
2021-03-04 09:40:38 -08:00
Wez Furlong
c6334a45dd extract window::input to wezterm-input-types 2020-12-09 13:48:23 -08:00