1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-23 23:21:08 +03:00
Commit Graph

4885 Commits

Author SHA1 Message Date
Wez Furlong
7a824a2594 client: remove race condition in cli shutdown
The client machinery would try to spawn an async attempt at
detaching the unixdomain from the mux on shutdown, but since
we're in the middle of tearing down the scoped executor,
we could sometimes panic.

The client we have in this situation isn't actually associated
with a domain, so we don't need to detach in that situation.

Formalize that by making it an Option, and address the
fanout.
2022-01-07 17:51:10 -07:00
Wez Furlong
2695b30376 wezterm cli: suggest --new-window when no pane id is specified 2022-01-07 17:49:55 -07:00
Wez Furlong
5f77936152 wezterm cli: replace SimpleExecutor with ScopedExecutor
This is slightly nicer
2022-01-07 17:12:35 -07:00
Wez Furlong
e8995c5370 wezterm-gui start now prefers to run via existing gui instance
Using the new publish/discovery stuff from the past couple of commits,
if we can find a matching socket path for a running gui, and the
configuration is likely a match, then use the mux protocol to talk
to the already running gui and ask it to spawn the equivalent program
into the same process.

refs: https://github.com/wez/wezterm/discussions/1486
2022-01-07 17:12:35 -07:00
Wez Furlong
67b8c453ca windows: adjust wait mask to include posted messages
This improves latency in situations where other applications
are using eg: SetWindowPos on wezterm's window handle.

refs: https://github.com/wez/wezterm/issues/1013
refs: https://github.com/wez/wezterm/issues/1398
refs: https://github.com/wez/wezterm/issues/1484 (maybe; cannot
reproduce, but I don't want to install a window manager)
2022-01-07 16:39:11 -07:00
Wez Furlong
33dd3f393c fix leader key deactivating on key up
refs: https://github.com/wez/wezterm/issues/1520
refs: #1483
2022-01-07 14:10:27 -07:00
Wez Furlong
78c4c56425 input: fix KeyCode::Physical -> termwiz KeyCode conversion
refs: https://github.com/wez/wezterm/issues/1519
refs: #1483
2022-01-07 14:01:01 -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
4efcc81bee fix windows build 2022-01-07 07:33:11 -07:00
Wez Furlong
3c6bc2c366 add ActivatePaneByIndex key assignment action
refs: #1517
2022-01-07 07:30:17 -07:00
Wez Furlong
5736e4b80d fix build on unix 2022-01-07 07:16:37 -07:00
Wez Furlong
ec94bc989b client: NameHolder: cleanup published symlink on drop 2022-01-06 22:35:25 -07:00
Wez Furlong
17a9d6159a wezterm cli now prefers to talk to main GUI instance
When spawned with no WEZTERM_UNIX_SOCKET environment set,
we now prefer to resolve the gui instance, falling back to
the mux if it doesn't look like the gui is running.

`wezterm cli --prefer-mux` will use the original behavior of
trying to resolve the path from the unix domain in the config.
2022-01-06 22:31:42 -07:00
Wez Furlong
eddf1c031a refactor: move gui socket list from update module to discovery module 2022-01-06 21:55:16 -07:00
Wez Furlong
213507c923 client: unix version of gui socket discovery 2022-01-06 21:50:18 -07:00
Wez Furlong
bd952bcc2b input: fix key_is_down in RawKeyEvent on windows 2022-01-06 20:11:55 -07:00
Wez Furlong
91fc705e26 gui/client: add stubs for publishing a main gui instance sock path
This will help to route things through a main gui instance per desktop
session/class.

Currently has stubs for windows.
2022-01-06 20:07:46 -07:00
Wez Furlong
72595d99d1 input: add Backspace to win32-input-mode list
refs: #1515
2022-01-06 17:47:29 -07:00
Wez Furlong
6cf6084c6d docs: clarify timeout for toast notifications
cc: @plscks

refs: #1514
2022-01-06 12:31:58 -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
ca8362ff08 input: fix modifier only win32-input-mode reporting
Normalize the left/right to the main VK.

Fixup the left/right control modifier flags: they were flipped!

refs: https://github.com/wez/wezterm/issues/318
refs: https://github.com/wez/wezterm/issues/1509
refs: https://github.com/wez/wezterm/issues/1510
2022-01-06 10:55:52 -07:00
Wez Furlong
ce23ee9eb8 input: generate win32-input-mode for a subset of keys
This commit causes the terminal to emit win32-input-mode encoded key up
and down events for a limited subset of keys When win32-input-mode is
enabled.

We limit them to keys where we know the VK key code equivalent,
and where those keys are either not representable (eg: modifier
only key events), or may generate ambiguous output (eg: CTRL-SPACE
in different keyboard layouts).

However, in my experiments, modifier only key presses confuse powershell
and cause it to emit `@`, so I've disabled that in the code for now.

refs: https://github.com/wez/wezterm/issues/318
refs: https://github.com/wez/wezterm/issues/1509
refs: https://github.com/wez/wezterm/issues/1510
2022-01-06 10:19: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
763c4d7f7e term: reintroduce possibility of key_up events
Nothing generates them right now, and the mux client has no
way to represent them on the wire.

I'm considering constraining them to just win32 for now.

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
dc204c03d6 term: propagate wezterm debug_key_events config
Log the sequence being sent to the terminal when enabled.
2022-01-06 08:01:25 -07:00
Wez Furlong
51aec27ec2 termwiz/term: introduce KeyboardEncoding enum, existence of win32-input-mode
This is a baby step that formalizes the different encoding schemes into
an enum, and hooks up the decset sequence for win32-input-mode.

It doesn't change any of the actual encoding at this time.

refs: #1509
2022-01-06 07:50:49 -07:00
unknown
ca0e358262 Fix uninit UB in filedescriptor unix.rs 2022-01-06 06:17:54 -08:00
Wez Furlong
8437d787b8 ls-fonts --text used wrong per-glyph text
It was showing the whole text for the cluster for each shaped
glyph.

Fix it up to map back to the corresponding cell range and
extract the text from the line.

Include the x_advance metric in the output while we're in
there.

refs: https://github.com/wez/wezterm/issues/1333
2022-01-05 23:36:33 -07:00
Wez Furlong
91a423da96 docs: changelog for 2a0de16b7b
refs: https://github.com/Canop/broot/issues/473
2022-01-05 20:15:56 -07:00
Wez Furlong
1131f2dce6 docs: changelog for IME/dead key composition 2022-01-05 20:11:41 -07:00
Wez Furlong
9f6f901f5b launcher: unbreak filtered view
I refactored and accidentally used entries instead of filtered_entries
2022-01-05 19:56:14 -07:00
Wez Furlong
41ce7903a9 write -> write_all, h/t clippy via @CGMossa 2022-01-05 18:52:14 -07:00
Wez Furlong
2a0de16b7b term: respect row/column scaling for image attachments
This got lost along the way somewhere, but now it's back!

refs: https://github.com/Canop/broot/issues/473
2022-01-05 18:24:21 -07:00
Wez Furlong
1dc5af5e69 x11: ime: enable pre-edit callbacks to show compose status
This also adjusts the IME position so that it doesn't obscure
the composition status.

refs: https://github.com/fcitx/xcb-imdkit/issues/9
2022-01-05 15:36:20 -07:00
Wez Furlong
90e244d731 bump codec version for abi change around sgrpixels
Multiplexer would error out when mousing over the window!

refs: #1457
2022-01-05 11:44:03 -07:00
Wez Furlong
59f5b849c5 gui: treat IME composition region as a giant stretched cursor
That way we get consistent styling for the span of the composing text
2022-01-05 10:52:33 -07:00
Wez Furlong
e66b788759 windows: feed dead key composition state to gui layer 2022-01-05 10:34:18 -07:00
Wez Furlong
27d84e08de windows: route IME composition to render layer
This shows the pending composition in the same font as the terminal display,
rather than the anemic looking system default font!
2022-01-05 10:29:27 -07:00
Wez Furlong
612afca961 windows: restore recognizing the Insert key
refs: #1483
2022-01-05 09:49:33 -07:00
Wez Furlong
b05cb1241e force clusters to break around cursor boundary
When rendering the IME composing text, I noticed that for the Korean
input sequence: shift+'ㅅ' followed by 'ㅏ' we'd render the 'ㅆ' (the
shifted first character) in black and the composing 'ㅏ' in white
against the cursor color, and that was very difficult to read,
especially at the default font size.

To resolve this, this commit:

* Forces clustering to break around the cursor boundary, so that
  we treat the cursor position as its own separately styled cluster
* Adjusts cursor/bg rendering so that we always consider the start of
  the cluster for the colors of that run.  We are guaranteed that a
  ligatured sequence will fit in the background area anyway.

This has the effect of "breaking" programming ligatures such as '->'
when cursoring through them, and decomposing them into their individual
'-' and '>' glyphs, which is a reasonable price to pay for being able
to see things better on screen.

refs: https://github.com/wez/wezterm/issues/1504
refs: https://github.com/wez/wezterm/issues/478
2022-01-05 09:20:11 -07:00
Wez Furlong
2456eefaa6 cargo fmt 2022-01-05 08:49:50 -07:00
Wez Furlong
f11281a4fa window: downgrade fallback error to warning level
refs: #1505
2022-01-05 08:33:03 -07:00
Wez Furlong
cc9ceeef22 macos: feed dead key composition to IME composing status
Now we can show the in-progress dead key composition on macos
2022-01-05 08:29:54 -07:00
Wez Furlong
0d6fbc1aa2 macos: improve ime vs dead key composing
When we translate a dead key, send the composed event immediately
and don't try to route the current key press via the IME.

Improve rendering when in the composing state: overlay the composing
text at the cursor position to show what the composing text would
look like, even though it hasn't been committed to the input stream
yet.

refs: https://github.com/wez/wezterm/issues/1504
2022-01-05 07:50:12 -07:00
Wez Furlong
71dae34b75 macos: improve IME handling
For Korean text input, pressing SHIFT and then typing in certain
keys begins a composition sequence.  Our logic for when to route
via the IME got so distracted by ALT that it didn't consider SHIFT
and didn't send this sequence to the IME, so we'd fail to compose
those sequences.

While poking at this, I realized that we should treat this composition
similarly to dead keys, in that we can signal the term window to
highlight the cursor color and report that status.

There's some further work to do: the composing text should be rendered
by us.  So far our IME integration assumes that the IME itself will
render over the top of our window, but for this particular input
it doesn't do that.

refs: https://github.com/wez/wezterm/issues/1504
2022-01-04 22:51:49 -07:00
Wez Furlong
32c39fe5ae docs: changelog for #1457 2022-01-04 20:51:58 -07:00
Wez Furlong
6d72101879 launcher: restore j/k movement by default
You now press `/` to enter search mode
2022-01-04 20:49:21 -07:00
Wez Furlong
621dcd3b30 launcher: don't fall off bottom of launcher when filtered 2022-01-04 20:49:21 -07:00
Wez Furlong
6927faebfb launcher: refactor and simplify 2022-01-04 20:49:21 -07:00