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

1069 Commits

Author SHA1 Message Date
Wez Furlong
c71e22e57d keyevent: fixup prevent_fallback processing
refs: #2702
2022-11-07 09:36:25 -07:00
Wez Furlong
6aceb97ded keys: add prevent_fallback option for ActivateKeyTable
The behavior is to prevent falling back to a later key table
if no key matched.

refs: https://github.com/wez/wezterm/issues/2702
2022-11-04 07:02:36 -07:00
Magnus Groß
0d4cd8a1e0 Allow to pass the command to execute via "-e"
Right now wezterm already allows to pass a cmdline to execute (instead
of the shell) by calling "wezterm start" with trailing arguments, e.g.
wezterm start -- bash

However, most other terminals implement this via a "-e" option. This
seems to be adopted widely in the wild, such that some third-party
frameworks just blindly expect the user's terminal to use the "-e"
option for this.

One such notable framework is kio from KDE Plasma, that calls the user's
terminal in that way when launching a desktop file that uses
Terminal=true. [1]

To solve this problem, we add a compatibility layer by adding a dummy
"-e" option. This will then consume the "-e" leaving the remaining
arguments as trailing arguments, which will later be consumed by our
existing implementation in the "prog" option.

Given that clap does not really support multiple arguments writing to
the same destination [2], this seems like the most sane implementation,
even if it is a hack.

It seems to work reliable, even for edge cases where we pass wezterm
options as trailing arguments, e.g. the following will just work and do
the expected outcome (and will **not** parse "--position" as a wezterm
argument):
wezterm start -e echo --position 10,10

Fixes #2622

[1] https://bugs.kde.org/show_bug.cgi?id=459616
[2] https://github.com/clap-rs/clap/issues/3146
2022-11-04 06:32:32 -07:00
Wez Furlong
43f2265ef1 deps: textwrap -> 0.16
closes: https://github.com/wez/wezterm/pull/2664
2022-10-23 20:50:47 -07:00
Wez Furlong
b1faba9d8a deps: upgrade finl_unicode to 1.2 2022-10-23 12:07:00 -07:00
Wez Furlong
4f05e2e1f1 render: remove redundant extra quad buffer
I can't think of a good reason for this being here.  I think I
may have been lazy about resolving the lifetime annotations
and just stuck in an extra buffer while building the original
version of this logic, and then forgot about it.

This commit resolves the lifetime annotations and directly
references the passed in buffer.

refs: https://github.com/wez/wezterm/issues/2626
2022-10-22 19:51:52 -07:00
Wez Furlong
35ce2fe74d trim heap usage
I spent a few hours in heap profilers.  What I found was:

* Inefficient use of heap when building up runs of
  `Action::Print(char)`.
    -> Solve by adding `Action::PrintString(String)`
  and accumulating utf8 bytes rather than u32 codepoints.
* Inefficient use of heap when building Quad buffers: the default
  exponential growth of `Vec` tended to waste 40%-75% of the allocated
  capacity, and since we could keep ~1024 of these in cache, there's
  a lot of potential for waste.
   -> Solve by bounding the growth to 64 at a time.  This has similar
   characteristics to exponential growth at the default 80x24 terminal
   size.  May need to add a config option for this step size for users
   with very large terminals.
* Lazy eviction from the LFU caches. The underlying cache advisor is
  somewhat probabilistic and has a minimum cache size of 256, making
  it difficult to maintain low heap utilization.
   -> Solve by replacing it with a very simple LFU algorithm. It doesn't
   seem to hurt much at the default terminal size with the default
   cache sizes.  If we make the cache sizes smaller, its overhead is
   reduced.

Some further experimentation is needed to adjust defaults, but this
should help reduce heap usage.

refs: https://github.com/wez/wezterm/issues/2626
2022-10-22 17:10:36 -07:00
Wez Furlong
5dd1f513f9 reduce log level strength of "breaking on overflow" 2022-10-22 06:26:10 -07:00
Wez Furlong
ec4d5eb1d5 gui: set up mux socket for wezterm connect case as well
It can be helpful for debugging purposes.
The socket can be discovered by setting:

WEZTERM_LOG=wezterm_mux_server_impl::local=trace,info

to get it to log a line like:

```
setting up /Users/wez/.local/share/wezterm/gui-sock-38183
```

Then it can be helpful to do:

```
WEZTERM_UNIX_SOCKET=/Users/wez/.local/share/wezterm/gui-sock-38183 wezterm cli list
```

to see what is in the gui's mux model.

refs: https://github.com/wez/wezterm/issues/2616
2022-10-17 20:45:32 -07:00
Wez Furlong
313fabd747 keys: ctrl-shift-1 didn't switch to the first tab
When using `key_map_preference="Mapped"`, `ctrl-shift-1` is actually
`ctrl-shift-!` in a US layout.

This commit adds the us-layout mapping for shifted number keys to
allow that to work, but it is worth calling out that this will only
be meaningful in layouts that have the same US mapping for the number
keys.

refs: https://github.com/wez/wezterm/issues/2623
2022-10-15 09:14:42 -07:00
Wez Furlong
b2e901ecd3 launcher: don't panic when launching nothing
refs: https://github.com/wez/wezterm/issues/2629
2022-10-15 08:55:11 -07:00
Wez Furlong
3c06b99675 charselect: improve compatibility with QMK unicode inputs
refs: https://github.com/wez/wezterm/issues/2581
2022-10-11 10:57:56 -07:00
Wez Furlong
4e5945c061 Add ResetTerminal and pane:inject_output method
refs: https://github.com/wez/wezterm/discussions/2606
2022-10-08 10:25:22 -07:00
Wez Furlong
473316934b add window-focus-changed event 2022-10-08 09:45:57 -07:00
Wez Furlong
0e98b23392 tweak --always-new-process messaging
refs: https://github.com/wez/wezterm/discussions/2589
2022-10-06 18:14:32 -07:00
Wez Furlong
eefd57b8ed fmt 2022-10-04 19:09:09 -07:00
Wez Furlong
1a4749940b fix charselect panic when pressing enter on no matches
refs: https://github.com/wez/wezterm/issues/2580
2022-10-04 09:09:47 -07:00
Wez Furlong
2cae10016f deps: update emojis crate 2022-10-04 09:00:18 -07:00
Wez Furlong
a050849695 deps: update to clap 4
Deal with some breaking changes
2022-10-04 08:55:31 -07:00
Wez Furlong
3c1cf930ae ls-fonts: --rasterize-ascii now works for custom glyphs 2022-09-24 08:16:22 -07:00
Wez Furlong
8e7a2cce79 overlays: pass down window config and apply overrides
refs: https://github.com/wez/wezterm/issues/2544
2022-09-23 05:00:31 -07:00
Wez Furlong
c839aeb431 reduce 'cancel mux subscription' log from error -> error 2022-09-22 07:32:56 -07:00
Wez Furlong
07675d5d57 copy-mode: fix greediness of jump
refs: https://github.com/wez/wezterm/issues/2528#issuecomment-1254557556
2022-09-22 06:15:14 -07:00
Wez Furlong
9a7aad0200 add window:is_focused() method
refs: https://github.com/wez/wezterm/discussions/2537
2022-09-21 19:44:44 -07:00
Wez Furlong
134c804cea copy mode: fixup jump position
refs: https://github.com/wez/wezterm/issues/2528#issuecomment-1253773858
2022-09-21 19:05:04 -07:00
Wez Furlong
b11451f727 add wezterm ls-fonts --codepoints 2022-09-20 22:06:03 -07:00
Wez Furlong
4d45bd7bc4 remove FIXME: I fixed it differently 2022-09-20 19:54:59 -07:00
Wez Furlong
7f65c2242b copy-mode: vim style jump to character motion
refs: https://github.com/wez/wezterm/issues/2528
2022-09-20 19:52:20 -07:00
Wez Furlong
1b99690990 Add superscript and subscript cell attributes
I've expanded the number of bits from 16->32 without impacting
the overall struct sizes and reserved 2 bits for super/subscript.
I refer to these as vertical alignment properties for conceptual
consistency with css.

SGR 73, 74, 75 are used to set super, sub and normal vertical alignment.
These are compatible with mintty.

However, mintty just added support for setting both attributes to render in
small caps in 06ac446049
(https://github.com/mintty/mintty/issues/1171)
2022-09-19 06:42:14 -07:00
Wez Furlong
5a754e44e7 avoid panic when attempting to search the launcher menu
refs: https://github.com/wez/wezterm/issues/2529
2022-09-18 13:06:29 -07:00
Wez Furlong
5625ae53ed fix tests for nerdfont update 2022-09-17 06:38:22 -07:00
Wez Furlong
85db555b37 deps: update finl_unicode 2022-09-16 07:47:33 -07:00
Wez Furlong
10cd78a81a fonts: remove last resort font
I was going to upgrade to the unicode 15 font, but in testing this I
decided that the logic is slightly complex and the glyphs are often
difficult to see at most terminal font sizes, which generates questions
from users, so just fall back to notdef.
2022-09-15 08:23:58 -07:00
Wez Furlong
42e4a51a28 lua: no longer distinction between gui and mux panes
There is no gui-specific functionality for PaneObject, so
just fold everything into MuxPane and use that.
2022-09-11 07:05:48 -07:00
Wez Furlong
295677ed52 config: cursor_thickness, strikethrough_position, underline_position, underline_thickness
refs: https://github.com/wez/wezterm/issues/2326
refs: https://github.com/wez/wezterm/issues/2505
2022-09-10 18:34:35 -07:00
Wez Furlong
72674f5d28 perf: reduce number of calls to Line::get_cell
The clustered line storage impl of get_cell() is O(column-index)
as cells have to be iterated in order.

The render pass was calling it 3 times to resolve information
about the cursor; reduce that to just once.

It was also calling it once per cell to determine whether the
cell needed to be replaced with a custom glyph if custom block
glyphs were enabled, making it accidentally quadratic!

While it wasn't especially expensive, it did show up in profiling,
so this commit removes that call: we can cache the block glyph
key in the shaper info which is a better place for it anyway,
so that's what we do.

Similarly, there was some extraneous work to call get_cell
when computing some shaper info; remove that too!

That one might be slightly contentious: the is-followed-by-space
logic used to check the successor cell by index to see if it
was a space, but now looks at the successor shaped glyph to see
if it was a space. That might actually be a better choice, but
it may have some ripple effects.
2022-09-10 09:11:22 -07:00
Wez Furlong
96c4e7e9b9 Switch to finl_unicode for grapheme clustering
According to its benchmarks, it's almost 2x faster than
unicode_segmentation.  It doesn't appear to make a visible
difference to `time cat bigfile`, but I'll take anything
that gives more headroom for such little effort of switching.
2022-09-10 07:15:49 -07:00
Wez Furlong
ad35b9dc21 Add compile time features to allow building without vendored fonts
closes: #2305
2022-09-09 08:53:39 -07:00
Wez Furlong
39dd4cdd82 Add config options to control various cache sizes
These are more for low level testing than they are intended
for users to play with, so they are deliberately undocumented
at this time.
2022-09-09 07:30:53 -07:00
Wez Furlong
25cd05a80a ls-fonts: cut over to glyphcache's rasterizer
This way we get the same metrics and rendering as used by
the main termwindow
2022-09-08 19:16:26 -07:00
Wez Furlong
598f5081ec respect invisible text attribute
This is a weird attribute TBH.

xterm seems to replace the cells with spaces: copying and pasting
results in spaces.

Kitty ignores it.

VTE doesn't render it but allows copying and pasting.

The latter is now also the behavior in wezterm.
2022-09-08 08:43:27 -07:00
Wez Furlong
c0fff4e843 Add wezterm.gui.default_key_tables()
This provides a means for more easily extending the default key
tables without forcing the user to recreate the entire config
for themselves.

wezterm.gui.default_keys is also added by this, but it is likely
not as useful.
2022-09-07 10:21:54 -07:00
Funami580
cd2c2a1a83 charselect: add option to cycle to previous group of characters 2022-09-07 10:21:35 -07:00
Wez Furlong
026b9e3577 fix hyperlink underlines
There were two problems:

* We weren't correctly invalidating when the hover state changed
  (a recent regression caused by recent caching changes)
* We'd underline every link with the same destination on hover,
  not just the one under the mouse (longstanding wart)

Recent changes allow the application layer to reference the underlying
Lines directly, so we can restore the original and expected
only-highlight-under-the-mouse by switching to those newer APIs.

Adjust the cache values so that we know to also verify the current
highlight and invalidate.

I was a little surprised to see that this also works with mux client
panes: I was expecting to need to do some follow up on those because
they return copies of Line rather than references to them. That happens
to work because the mux client updates the hyperlinks at the time where
it inserts into its cache. The effect of that is that lines in mux
client panes won't update to new hyperlink rules if they were received
prior to a change in the config.

refs: https://github.com/wez/wezterm/issues/2496
2022-09-07 07:51:28 -07:00
Wez Furlong
72c83e0599 ls-fonts: fix ascii rasterization of emoji/bitmap fonts
Need to scale them using the same rules we do when the window
renders them for real.

wezterm  ls-fonts --text "$(printf hi\\U1faf0💩)" --rasterize-ascii
2022-09-06 18:49:20 -07:00
Wez Furlong
ea1513f480 Search incrementally in chunks of 1000 lines, show progress
This makes the search feel more responsive.

We search from bottom to top so that we show the more recent results
first, but for the sake of efficiency when accumulating result chunks
we need to reverse the order of the results vec from how it was
previously.

Each result chunk is loosely ordered from top to bottom, so we sort
it and reverse it: results[0] is the bottom-most result.

New rows are accumulated on the end of the result array; this is
not only more efficient, but it preverses the match result number
ordering.

The next/prior functions need to be swapped to account for this change
in result order.

refs: https://github.com/wez/wezterm/issues/1209
2022-09-05 09:21:20 -07:00
Wez Furlong
6b81cd4777 fix quad cache top pixel value
It was set to the first non-tab bar pixel y coordinate rather than
the line y pixel coordinate.

Move the calculation up!

refs: https://github.com/wez/wezterm/issues/2483
2022-09-05 07:52:10 -07:00
Wez Furlong
a29d8ed4ae charselect: options to control copy behavior, + docs
refs: https://github.com/wez/wezterm/issues/2163
2022-09-03 13:58:50 -07:00
Wez Furlong
0a3998887f correctly invalidate line shape data when fallback fonts load async
Ensure that the cache key changes when the shape generation changes
2022-09-03 09:31:08 -07:00
Wez Furlong
1b9ea2de3f change text cursor to fa_lock when entering passwords
There are caveats to determining this, but when we think
password entry is enabled, switch the cursor to the font-awesome
lock glyph instead of the normal cursor sprite.

fa_lock is used because it is monochrome and can thus be tinted
to the configured cursor color, and it respects blinking/easing.

refs: https://github.com/wez/wezterm/issues/2460
2022-09-02 09:00:28 -07:00