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

1025 Commits

Author SHA1 Message Date
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
Wez Furlong
14c613a064 add Pane::get_metadata
The idea here is that different kinds of panes may want to expose
additional metadata to lua scripts. It would be a bit weird to add
a Pane method for each of those and plumb it all the way through
the various APIs, so just allowing a pane impl to return a dynamic
value (likely an Object) allows a bunch of flexibility.

This commit exposes the clientpane is_tardy boolean and the time
since the last data was recevied (since_last_response_ms) from
the mux client pane implementation: these are used to show the
tardiness indicator in the client pane.

Exposing this data enables the user to add that info to their
status bar if they wish.
2022-09-01 21:27:49 -07:00
Wez Furlong
8adc78b587 reset mouse cursor to arrow when mouse leaves the window
refs: https://github.com/wez/wezterm/issues/2471
2022-09-01 18:45:20 -07:00
Wez Furlong
16bf00c63c charselect: add explicit recent category, show category in UI
The default behavior for charselect is to show the recent category
if you have previously used it, otherwise, show the default emotion
category.

refs: https://github.com/wez/wezterm/issues/2163
2022-09-01 07:19:17 -07:00
Wez Furlong
7670c4f0ae char selector: track recently selected emoji and use frecency to show it
refs: https://github.com/wez/wezterm/issues/2163
2022-08-31 22:56:58 -07:00
Wez Furlong
ed731a0d8d Add CharSelect modal for emoji/nerdfont/unicode input
CTRL-SHIFT-U is a new default key assignment for this new modal.
It opens up a fuzzy searchable browser that defaults to showing
emoji/emoticons.  The category can by cycled through the suggested
emoji categories using CTRL-r.  Unlike the system emoji palette,
wezterm includes a category for nerdfont symbols, and another
that is a list of all unicode codepoint names, so you should be
able to browse for pretty much any codepoint you can think of.

The modal also allows fuzzy searching based on:

* The official unicode name
* The github shortcode
* codepoint value in hex

so if you know the codepoint value but not the name, you can
still find a way to input what you're looking for.

Pressing Enter will copy the selected item to the clipboard
send it to the active pane, and cancel the modal. You can therefore
repeat the insert by simply pasting.

I plan to add frecency to this in a later commit: that way the
frequently/recently used selections will show in a category of
their own and make it easier to re-input them.

refs: https://github.com/wez/wezterm/issues/2163
2022-08-31 18:15:28 -07:00
Wez Furlong
ccc1a2beff add pane_id and active state to render cache key
refs: https://github.com/wez/wezterm/issues/2467
2022-08-30 08:18:13 -07:00
Wez Furlong
60c5eb1f51 add cursor shape/visibility to quad cache key
otherwise strangeness can occur in vim when vim hides the cursor
as part of partially updating the screen.
2022-08-30 07:28:13 -07:00
Wez Furlong
b9d0843b71 deps: tiny-skia 0.7 -> 0.8 2022-08-28 20:50:27 -07:00
Wez Furlong
9732f9ee2b Adjust render caching; switch to LFU caches from LRU 2022-08-28 10:28:26 -07:00
Wez Furlong
1398c0d4b0 add user-var-changed event 2022-08-27 17:22:21 -07:00
Wez Furlong
3c7b75a4f3 fixup invalidation of blinking cursor, and on focus change 2022-08-27 12:14:10 -07:00
Wez Furlong
d38caf4088 cargo fmt 2022-08-27 10:32:01 -07:00
Wez Furlong
bf39e90676 track fps and recent frame duration for diagnostic purposes 2022-08-27 09:10:26 -07:00
Wez Furlong
5d250bce36 invalidate shape cache when reverse video mode changes 2022-08-27 08:47:22 -07:00
Wez Furlong
cb9fe1a676 flesh out some todos with new pane trait methods
Tidy some things up to avoid some dead code and redundant impls.
Make it easier to select whether you want to implement the new
methods in terms of the old, or the old methods in terms of
the new in a given pane impl.
2022-08-27 07:58:17 -07:00
Wez Furlong
d492eef700 implement new pane trait methods for copy and quickselect overlays 2022-08-27 06:19:12 -07:00
Wez Furlong
f03dc68f96 move shape & quad caching to hang off Line appdata
Remove the faulty cache key stuff and hang references to the cached
data directly off the underlying Line.  That makes the association
between the the Line and the data O(1) plus some basic cache
invalidation checks.

Adjust the shape cache portion of this to use the same ID for the
shape, so that things that invalidate just the quads (such as cursor
movement when not composing, and selection) only need to recompute
the quads without re-shaping.
2022-08-26 21:49:33 -07:00
Wez Furlong
b7b1e4020a revise Pane line related funcs
Adds Pane::for_each_logical_line_in_stable_range_mut and
Pane::with_lines_mut which allow iterating mutably over lines.

The idea is that this will allow the renderer to directly cache
data in the Line via its appdata without having to build cumbersome
external caching logic and managing cache keys.

This commit just swaps the implementation around for localpane
and sanity checks that the renderer functions.

Various overlays and the mux client don't properly implement these
yet and current warn at compile time and panic at runtime.

To follow is the logic to cache the data and make sure that it
works the way that I think before converting the other Pane
implementations.
2022-08-26 08:05:06 -07:00
Wez Furlong
6962d6805a cargo fmt 2022-08-24 23:04:15 -07:00
Wez Furlong
c4ea703d4b disable some of the recent caching stuff
The cache key isn't quite right, leading to some artifacts
in some cases.

I have a cunning plan, but it will take me a bit to wrap
it up, so in the meantime, disable these caches.

refs: https://github.com/wez/wezterm/issues/2455
2022-08-24 22:57:57 -07:00
Wez Furlong
5e993c581a termwiz: remove reverse video attribute from Line
It didn't really belong there; it was added as a bit of a hack
to propagate screen reverse video mode.

Move that to the RenderableDims struct and remove the related
bits from Line
2022-08-24 22:43:47 -07:00
Wez Furlong
0fe8bba147 fix copymode and quickselect overlays
the new caching broke these because they play dirty tricks by
aliasing the delegated pane id.

Skip caching for those by reporting the pane_id as None
2022-08-24 08:07:16 -07:00
Wez Furlong
ad7199c1cc trim down lru cache sizes
refs: https://github.com/wez/wezterm/issues/2453
2022-08-23 22:34:26 -07:00
Wez Furlong
3b4e859956 allow cursor_fg = "none" to use text fg color
Similar to selection_fg, setting the cursor_fg to transparent ("none")
will use the foreground color of the text behind the cursor.

refs: https://github.com/wez/wezterm/issues/1835
2022-08-23 19:54:19 -07:00
Wez Furlong
0141d340f3 gui: cache get_lines_with_hyperlinks_applied
If the pane is unchanged and we're at the same viewport, cache
the values from the last call.
2022-08-23 17:39:56 -07:00
Wez Furlong
03246fba23 gui: factor out background rect calc
avoid some copypasta
2022-08-23 17:16:04 -07:00
Wez Furlong
9029b3bca6 fix blinking text 2022-08-23 14:43:35 -07:00
Wez Furlong
65d350be36 fixup retro tab bar
I broke this with the performance changes I pushed earlier today.

Poke a hole in caching for it as well, as it doesn't use the seqno
to track changes like the rest of the Line based data.

cc: @DeadlySquad13
2022-08-23 12:30:45 -07:00
Wez Furlong
619b1ad292 scroll to bottom on mouse input when mouse is grabbed
refs: https://github.com/wez/wezterm/issues/2447
2022-08-23 10:15:39 -07:00
Wez Furlong
144d2a353e add focus state to cache key 2022-08-23 09:41:44 -07:00
Wez Furlong
64a10014cf treat Constant ease-in-and-out as equivalent to "1 fps" case
This doesn't mean that it renders at 1fps, just that it goes through
the simpler path of scheduling on the boundaries rather than at
animation_fps through the intermediate stages, where it would be
useless.
2022-08-23 08:29:57 -07:00
Wez Furlong
f582d35d8e improve blink easing scheduling
We weren't really respecting animation_fps very well. Account
for the last_render time when computing the next frame time.
2022-08-23 08:17:46 -07:00
Wez Furlong
00ddfbf9b8 perf: cache quads by line
Introduces a heap-based quad allocator that we cache on a per-line
basis, so if a line is unchanged we simply need to copy the previously
computed set of quads for it into the gpu quad buffer.

The results are encouraging wrt. constructing those quads; the
`quad_buffer_apply` is the cost of the copy operation, compare with
`render_screen_line_opengl` which is the cost of computing the quads;
it's 300x better at the p50 and >100x better at p95 for a full-screen
updating program:

full 2880x1800 screen top:

```
STAT                                             p50      p75      p95
Key(quad_buffer_apply)                           2.26µs   5.22µs   9.60µs
Key(render_screen_line_opengl)                   610.30µs 905.22µs 1.33ms
Key(gui.paint.opengl)                            35.39ms  37.75ms  45.88ms
```

However, the extra buffering does increase the latency of
`gui.paint.opengl` (the overall cost of painting a frame); contrast the
above with the latency in the same scenario with the current `main`
(rather than this branch):

```
Key(gui.paint.opengl)                            19.14ms  21.10ms  28.18ms
```

Note that for an idle screen this latency is ~1.5ms but that is also true
of `main`.

While the overall latency in the histogram isn't a slam dunk,
running `time cat bigfile` is ~10% faster on my mac.

I'm sure there's something that can be shaved off to get a more
convincing win.
2022-08-23 06:37:12 -07:00
Wez Furlong
9aaa4c4db6 Abstract quad and layer allocation
allows adding an alternative, cacheable, quad backing in a subsequent commit
2022-08-22 19:48:19 -07:00
Wez Furlong
d2b3d7ed94 add cheaper to cache shape info
Use essentially just a couple of very cheap integers as cache keys
for the shape info from a pane
2022-08-22 18:37:11 -07:00
Wez Furlong
5f64adb7f0 start building out box model based render of pane 2022-08-22 11:03:24 -07:00
Wez Furlong
8040a8ae81 revise how uniforms are passed to shader
This is really a proof of concept commit; I want to be able to pass
more structured data into the shader as uniforms and the basic
macros provided by glium make that a bit awkward.

What I came up with is a slightly more dynamic uniform builder
thingy.

I'm using this to pass in a copy of the various blinking easing
functions.

Those are incomplete and unused, but it shows that the technique works.
2022-08-22 10:22:00 -07:00
Wez Furlong
f2f2b83899 respect close confirmation prompt when middle clicking a tab
refs: #2350
2022-08-21 09:34:24 -07:00
Wez Furlong
de89d650a3 cargo update 2022-08-21 08:51:16 -07:00
Wez Furlong
3917fc2184 tab bar: force x and + buttons to be square
Use the font height as the basis for the size, rather than the width,
to avoid the buttons being too condensed.

Explicitly use the pixel height for the dimensions so that the
buttons are square.

refs: https://github.com/wez/wezterm/issues/2399
2022-08-20 22:34:19 -07:00
Wez Furlong
78b5ac0eb5 add border size and color config
refs: https://github.com/wez/wezterm/issues/2417
2022-08-20 17:05:17 -07:00
Wez Furlong
8b3a52ba9a colors now override color_scheme
The prior mutually exclusive behavior kept surprising people so let's
just flip this around.

This is potentially a "breaking" change for folks, but I think it is
worth it.
2022-08-20 11:48:22 -07:00
Wez Furlong
8b2ef50ca7 gui-startup event now also works for wezterm ssh.
This is done by adjusting how `wezterm ssh` works; we now set up
the default domain and call into the main `wezterm start` logic.

refs: #284
2022-08-20 08:01:45 -07:00
Wez Furlong
429c18b7ee fixup boundary condition for MoveBackwardZoneOfType
refs: #2346
2022-08-20 07:35:28 -07:00