1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-13 07:22:52 +03:00
Commit Graph

5298 Commits

Author SHA1 Message Date
Wez Furlong
8ac793a619 add --position CLI option for requesting initial window position
refs: #1794
2022-04-02 09:32:21 -07:00
Wez Furlong
2faa6822f9 fix mac, windows builds
refs: https://github.com/wez/wezterm/issues/1794
2022-04-02 07:58:27 -07:00
Wez Furlong
89b653acb8 x11: respect requested x/y geometry if provided
refs: https://github.com/wez/wezterm/issues/1794
2022-04-02 07:47:03 -07:00
Wez Furlong
69288aee4c window: Add RequestedWindowGeometry type
This is mostly a refactoring: pulling out the discrete width/height from
the `new_window` method and preparing to pass down x/y coords as well.

The types are expressed as Dimension so that screen relative sizes could
be expressed in the future... once we know how to obtain that
information on each platform.

refs: https://github.com/wez/wezterm/issues/1794
2022-04-02 07:25:59 -07:00
Wez Furlong
bd02d33bf5 tab bar: constrain to constant height
The tab bar height could vary by a couple of pixels depending on the
text shown inside it, which results in visual jitter as the title bar
changes.

Avoid that: always return our constant reserved amount of space for the
tab bar, even if it means that there are a couple of pixels "wasted".

cc: @davidrios
2022-04-01 09:34:14 -07:00
Wez Furlong
dc414dfde0 keys: auto synthesize ctrl+shift versions of keys
This should prevent overlooking various weird cases for the ctrl-shift
versions of key assignments.
2022-04-01 09:20:09 -07:00
Wez Furlong
67218d3a85 fix formatting 2022-04-01 08:15:32 -07:00
Wez Furlong
8ba0ef2375 macos: notch avoidance tweak
https://github.com/wez/wezterm/issues/1737#issuecomment-1085923867
2022-04-01 08:14:11 -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
Wez Furlong
76cbcb1341 config: refactor to reduce repeating key+mods
Use serde(flatten) so we can reuse KeyNoAction for 3 different structs.
2022-03-31 22:38:56 -07:00
Wez Furlong
27d7666a8d downloader: restructure how we propagate to the gui
same deal as 210999b915 but for the
download handler.

The download handler doesn't work across the multiplexer today.
2022-03-31 20:06:43 -07:00
Wez Furlong
675ea03338 docs: changelog for https://github.com/wez/wezterm/issues/1787
closes: https://github.com/wez/wezterm/issues/1787
2022-03-31 19:30:19 -07:00
Wez Furlong
210999b915 clipboard: restructure how we capture OSC 52
Previously, we'd create a clipboard handler associated with a GUI window
and take care to pass that down to the underlying Pane whenever we
spawned a new pane.

For the mux server, instead of being associated with a GUI window, the
clipboard was a special RemoteClipboard that would send a PDU through
to the client that spawned the window.

The bug here was that when that client went away, the clipboard for
that window was broken.

If the mux server was the built-in mux in a gui process this could
leave a tab without working OSC 52 clipboard support.

This commit restructures things so that the Mux is responsible for
assigning a clipboard handler that rephrases the clipboard event
as a MuxNotification.

Both the GUI frontend and the mux server dispatcher already listen
for mux notifications and translate those events into appropriate
operations on the system clipboard or Pdus to send to the client(s).

refs: #1790
2022-03-31 09:55:51 -07:00
Wez Furlong
34090580a0 tabbar: default to a dummy, non-empty state
This is to avoid computing a zero height initial tab bar as discussed
in 808d7df8d4 (commitcomment-69980693)

cc: @davidrios
2022-03-31 07:50:34 -07:00
Wez Furlong
1b31ee5f94 docs: changelog for #1800 2022-03-31 07:17:06 -07:00
David Rios
821b6f67bb Improve touchpad precision on Wayland 2022-03-31 07:15:45 -07:00
Wez Furlong
e23e972c5c sync color schemes
Sync with upstream: ba8c68f212
closes: https://github.com/wez/wezterm/pull/1767
2022-03-30 20:46:34 -07:00
Wez Furlong
53c47143fd term: scope the conpty resize quirks better to conpty on windows
Previously, we'd just default the resize quirk on for all programs on
Windows.

That pessimizes the otherwise fine behavior of `wezterm ssh` or mux
connections to unixy platforms.

This commit moves the quirk out of the config trait and makes it
a runtime property of the terminal, and then arranges for it
to be set when we know that we set up a conpty for the terminal.

refs: #1265
2022-03-30 08:06:45 -07:00
Wez Furlong
808d7df8d4 gui: fixup tab bar height issue
In https://github.com/wez/wezterm/pull/1779#issuecomment-1082058134 we
discuss a weird case where the tab bar height is computed as 0 and then
gets stuck at 0.

What's happening is that the initial `TabBarState::default()` value has
no items yet, and `build_fancy_tab` generates an area that occupies 0
pixels.  This computed element is cached, and then the height from that
is cached.

When `invalidate_fancy_tab` is called, it didn't invalidate the cached
height and the resultant metrics were wonky.

One possible fix for this was to also invalidate the cached height,
but since that height is already stored in the built fancy tab,
we can remove that derived-cached value in favor of just passing
down the value.

refs: https://github.com/wez/wezterm/pull/1779
2022-03-30 07:03:14 -07:00
Wez Furlong
ff88fec880 window: add Debug trait to os parameters types 2022-03-30 07:02:47 -07:00
Wez Furlong
6015957cd2 docs: changelog for #1525 2022-03-29 09:24:19 -07:00
Wez Furlong
ab944341d8 Minor tweaks 2022-03-29 08:55:25 -07:00
David Rios
45072fa475 Overhaul scroll thumb calculation
- Simplify scroll thumb calculations
- Correct thumb position when dragging with mouse
- Support border OS parameters
- Use usize for OS borders, to explicitly only accept positive integers
- Get correct tab height when using fancy tab bar
- Correctly draw depending on tab bar position
- Adjust minimum thumb size to be 1/2 of a cell height, so it has consistent size across platforms and screen densities

Fixes #1525
2022-03-29 08:55:25 -07:00
Muhammed Zakir
284afe0d4c Doc: Update keys.md: minor typo - add to 2022-03-29 08:12:28 -07:00
Wez Furlong
1a71a0b216 improve error logging for OSC 52 in mux
refs: #1790
2022-03-29 08:09:52 -07:00
Wez Furlong
f478672fd8 mux: fix artifacts in multi-pane layouts after closing a pane
refs: https://github.com/wez/wezterm/issues/1277
refs: https://github.com/wez/wezterm/issues/783
2022-03-28 22:47:32 -07:00
Wez Furlong
b398eaf656 mux: fix CloseCurrentPane={confirm=false}
After killing the remote pane, we no longer trigger the renderable
poll stuff that would detect that the pane was dead.

Let's speculatively set it to dead so that we don't get stuck with
stray tabs/panes.

https://github.com/wez/wezterm/issues/1752
2022-03-28 22:18:53 -07:00
Wez Furlong
1c9bd347c2 multiplexer: improve handling of image attachments
There were a a couple of issues:

* `ImageData::hash` would re-hash the image on every call, and this was
  called for every cell that comprised an image on the mux server side
* `SerializedLine` needed to understand how to remove the `Arc<ImageData>`
  image attachments so that we didn't serialize a complete copy of the
  image per cell that comprised the image.

A new RPC was introduced to attempt to fetch `ImageData` given its
content hash and pane, row and cell index as a hint to locate it.

A client side LRU of content hash to `ImageData` is used to avoid
issuing repeat calls to that new RPC.

refs: #1237
2022-03-28 20:28:05 -07:00
yuzu3886
2ceb2bd33d docs: fix invalid example 2022-03-28 19:55:23 -07:00
Wez Furlong
72214b7db9 Disable ligatures for Menlo and Monaco
refs: https://github.com/wez/wezterm/issues/1736
refs: https://github.com/wez/wezterm/issues/1786
2022-03-28 19:32:00 -07:00
Wez Furlong
a2004a2a7d fonts: workaround broken symbol fonts with 0 advances
The broot icon font has glyphs with horizontal advance set to 0.  That
would cause us to consider the glyph to be zero width, so handle that as
a special case.  Note that it is legit for certain cells to end up with
a zero advance/width during shaping if they represent combining
characters: this is more common in Arabic scripts.

refs: https://github.com/wez/wezterm/issues/1787
2022-03-28 18:05:13 -07:00
Wez Furlong
20688c4a62 docs for fallback font scaling
refs: #1761
2022-03-28 07:55:41 -07:00
Wez Furlong
ec022275e5 factor in notch/borders during resize
refs: #1737
2022-03-28 07:06:17 -07:00
Wez Furlong
b65cf803d7 fonts: show aliases in ls-fonts --list-system output 2022-03-27 20:21:09 -07:00
Wez Furlong
6dd3d55b0b fonts: show aliases in ls-fonts output 2022-03-27 19:56:11 -07:00
Wez Furlong
1cf0a76f3f deps: actions/cache -> v3
closes: https://github.com/wez/wezterm/pull/1782
2022-03-27 19:48:06 -07:00
Wez Furlong
d1f16ca927 deps: cargo update 2022-03-27 19:47:26 -07:00
Wez Furlong
6bd6d844ca term: fix XTGETTCAP response
refs: https://github.com/wez/wezterm/issues/1781
refs: https://github.com/dankamongmen/notcurses/issues/2637
2022-03-27 19:34:12 -07:00
Wez Furlong
a7f70ccf35 docs: sixel perf in the changelog 2022-03-27 16:32:36 -07:00
Wez Furlong
53fc926b1c gui: fix wonky logic for simple_dpi_change
The condition should be: dpi-changed && (close-enough-stuff)
but was (dpi-changed && (some-close-enough-stuff)) ||
(other-close-enough-stuff).

The net result was toggling non-native full screen on macos could
falsely try to do scale change handling even though the dpi was
unchanged, because the window resized by only a couple of pixels.
2022-03-27 16:28:07 -07:00
Wez Furlong
b9c194c0d3 sixel: remove leftover debug
refs: #217
2022-03-27 16:27:14 -07:00
Wez Furlong
77e5cdd00d sixel: improve sixel parsing performance.
Test scenario is:

```
wezterm -n --config enable_kitty_graphics=false
./notcurses-demo -p ../data iv
```

In `20220326-231415-4cd89333`

```
             runtime│ frames│output(B)│    FPS│%r│%a│%w│TheoFPS║
══╤════════╤════════╪═══════╪═════════╪═══════╪══╪══╪══╪═══════╣
 1│   intro│  12.38s│    238│  10.50Mi│   19.2│ 1│ 0│82│  22.82║
 2│    view│  37.87s│    982│  89.35Mi│   25.9│ 0│ 0│46│  54.31║
══╧════════╧════════╪═══════╪═════════╪═══════╧══╧══╧══╧═══════╝
              50.25s│   1220│  99.86Mi│
```

With this commit:

```
             runtime│ frames│output(B)│    FPS│%r│%a│%w│TheoFPS║
══╤════════╤════════╪═══════╪═════════╪═══════╪══╪══╪══╪═══════╣
 1│   intro│   3.39s│    458│  23.13Mi│  135.2│ 8│ 1│17│ 490.79║
 2│    view│  18.59s│    978│  89.35Mi│   52.6│ 1│ 0│ 5│ 645.10║
══╧════════╧════════╪═══════╪═════════╪═══════╧══╧══╧══╧═══════╝
              21.98s│   1436│ 112.48Mi│
```

as a point of comparison, here's the kitty protocol numbers on
the same build:

```
             runtime│ frames│output(B)│    FPS│%r│%a│%w│TheoFPS║
══╤════════╤════════╪═══════╪═════════╪═══════╪══╪══╪══╪═══════╣
 1│   intro│   3.68s│    485│  39.49Mi│  131.7│ 5│ 1│23│ 421.85║
 2│    view│  20.66s│    979│ 423.90Mi│   47.4│ 1│ 0│18│ 225.83║
══╧════════╧════════╪═══════╪═════════╪═══════╧══╧══╧══╧═══════╝
              24.34s│   1464│ 463.39Mi│
```

so we're now in the same ballpark.

cc: @autumnmeowmeow in case you have some other sixel benchmarks
to help verify this :)

refs: https://github.com/wez/wezterm/issues/217
2022-03-27 15:30:43 -07:00
Wez Furlong
15cd990e33 refactor: move sixel parser/builder to own file 2022-03-27 13:38:33 -07:00
Wez Furlong
5b0edfddea hyperlink rules: avoid panic when a capture is missing
```
./target/debug/wezterm -n --config 'hyperlink_rules={{regex="pr-(\\d+)(-\\d)?",format="https://github.com/NixOS/nixpkgs/pull/$1"}}'
```

then output `pr-1`.

refs: #1780
2022-03-27 11:12:16 -07:00
Wez Furlong
3c701d9dc8 mux: propagate focus changes to remote mux
Pretty much the same test plan as b4c4c85683

but start wezterm:

./target/debug/wezterm -n --config 'ssh_domains={{name="s",remote_address="localhost"}}' connect s

This reliably propagates focus=true events, but if the client switches
focus away from a mux pane to a local pane, then the focus=false event
may not be propagated to the remote mux.

refs: #1608
2022-03-27 09:30:18 -07:00
Wez Furlong
26acdae1d9 docs: changelog for #1757 #1710 2022-03-27 07:57:52 -07:00
Wez Furlong
045698e6ca x11: query focus prior to painting if we don't know focus state
We don't assume that we start up focused, and some WM don't tell
us our focus state, so prior to painting, if we don't know the
focus state, explicitly query it and synthesize a focus change event.

refs: https://github.com/wez/wezterm/issues/1757
2022-03-27 07:10:47 -07:00
Wez Furlong
4cd893335b fix build for intel mac 2022-03-26 23:14:15 -07:00
Wez Furlong
4e343eb1e5 macos: try to avoid the notch
Flesh out the get_os_parameters impl for macOS.  When running on a
system that provides `NSScreen::safeAreaInsets`, use that to determine
the border required to avoid the "notch" on certain models of mac.

In the GUI layer: when the os parameters include a border, adjust
the render position to account for it.

This is a bit of a speculative change, as I don't have a mac with
a notch.

refs: https://github.com/wez/wezterm/issues/1737
2022-03-26 22:47:42 -07:00
Wez Furlong
a61d3a1b99 macos: clear scroll remainder when changing scroll direction 2022-03-26 20:46:28 -07:00