1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-18 02:42:05 +03:00
Commit Graph

6021 Commits

Author SHA1 Message Date
Wez Furlong
e26d634da1 termwiz: refactor Line::visible_cells()
Don't promise that we iterate Cell directly, but things that smell
like Cell.  That makes it easier to adjust internal storage in
a later commit.
2022-07-23 07:03:34 -07:00
Wez Furlong
355f3d3975 fix reloading the global config when the appearance changes
We didn't actually update the global config, just the per-window
configs, which led to weird stale throwbacks to earlier versions
of the config when spawning windows or new panes.

Fix that up by explicitly reloading the global config when the
window appearance is changed.  That isn't ideal as we will reload
once per window, but it's "OK".

While poking at this, I noticed that the get/set config methods
on the termwiztermtab overlay weren't hooked up, and also made
a point of calling those for any overlays during a window config
reload event, so that per-window overrides are more likely to get
picked up and respected.

refs: https://github.com/wez/wezterm/issues/2295
2022-07-22 20:23:04 -07:00
Wez Furlong
bd79ee0bff termwiz: add bench for Cell creation/drop 2022-07-22 19:23:53 -07:00
Wez Furlong
3547efc567 term: refactor the charset/remapping out of flush_print
I wanted to rule it out of the profile, so put it in its own function
to confirm that it had neglibible cost for time cat bigfile.
2022-07-22 19:23:41 -07:00
Wez Furlong
9eeb9b7c43 termwiz: add static WcLookupTable to codegen
This shaves off some tiny overheads from lazy_static
2022-07-22 19:23:14 -07:00
Wez Furlong
308bbc9038 termwiz: micro-optimize grapheme_column_width
While profiling `time cat bigfile` I noted that a big chunk of the
time is spent computing widths, so I wanted to dig into a bit.

After playing around with a few options, I settled on the approach
in this commit.

The key observations:

* WcWidth::from_char performs a series of binary searches.
  The fast path was for ASCII, but anything outside that range
  suffered in terms of latency.
* Binary search does a lot more work than a simple table lookup,
  so it is desirable to use a lookup, and moreso to combine the
  different tables into a single table so that classification
  is an O(1) super fast lookup in the most common cases.

Here's some benchmarking results comparing the prior implementation
(grapheme_column_width) against this new pre-computed table
implementation (grapheme_column_width_tbl).

The ASCII case is more than 5x faster than before at a reasonably snappy
~3.5ns, with the more complex cases being closer to a constant ~20ns
down from 120ns in some cases.

There are changes here to widechar_width.rs that should get
upstreamed.

```
column_width ASCII/grapheme_column_width
                        time:   [23.413 ns 23.432 ns 23.451 ns]
column_width ASCII/grapheme_column_width_tbl
                        time:   [3.4066 ns 3.4092 ns 3.4121 ns]

column_width variation selector/grapheme_column_width
                        time:   [119.99 ns 120.13 ns 120.28 ns]
column_width variation selector/grapheme_column_width_tbl
                        time:   [21.185 ns 21.253 ns 21.346 ns]

column_width variation selector unicode 14/grapheme_column_width
                        time:   [119.44 ns 119.56 ns 119.69 ns]
column_width variation selector unicode 14/grapheme_column_width_tbl
                        time:   [21.214 ns 21.236 ns 21.264 ns]

column_width WidenedIn9/grapheme_column_width
                        time:   [99.652 ns 99.905 ns 100.18 ns]
column_width WidenedIn9/grapheme_column_width_tbl
                        time:   [21.394 ns 21.419 ns 21.446 ns]

column_width Unassigned/grapheme_column_width
                        time:   [82.767 ns 82.843 ns 82.926 ns]
column_width Unassigned/grapheme_column_width_tbl
                        time:   [24.230 ns 24.319 ns 24.428 ns]
```

Here's the benchmark summary after cleaning this diff up ready
to commit; it shows ~70-80% improvement in these cases:

```
; cargo criterion -- column_width
column_width ASCII/grapheme_column_width
                        time:   [3.4237 ns 3.4347 ns 3.4463 ns]
                        change: [-85.401% -85.353% -85.302%] (p = 0.00 < 0.05)
                        Performance has improved.

column_width variation selector/grapheme_column_width
                        time:   [20.918 ns 20.935 ns 20.957 ns]
                        change: [-82.562% -82.384% -82.152%] (p = 0.00 < 0.05)
                        Performance has improved.

column_width variation selector unicode 14/grapheme_column_width
                        time:   [21.190 ns 21.210 ns 21.233 ns]
                        change: [-82.294% -82.261% -82.224%] (p = 0.00 < 0.05)
                        Performance has improved.

column_width WidenedIn9/grapheme_column_width
                        time:   [21.603 ns 21.630 ns 21.662 ns]
                        change: [-78.429% -78.375% -78.322%] (p = 0.00 < 0.05)
                        Performance has improved.

column_width Unassigned/grapheme_column_width
                        time:   [23.283 ns 23.355 ns 23.435 ns]
                        change: [-71.826% -71.734% -71.641%] (p = 0.00 < 0.05)
                        Performance has improved.
```
2022-07-22 19:21:43 -07:00
Wez Furlong
354f3577b3 termwiz: add criterion benches for wcwidth 2022-07-22 19:21:25 -07:00
Wez Furlong
27df31e0d7 termwiz: make emoji presentation very slightly more efficient
When resolving the variation, we can pre-compute the base presentation
so let's combine that with the data in the perfect hash map.
2022-07-22 19:20:17 -07:00
Wez Furlong
f64a91783e term: remove Line::invalidate_implicit_hyperlinks calls
We haven't set implicit hyperlinks in the term layer for a long
time; these calls are no longer needed.
2022-07-22 19:18:23 -07:00
yashpalgoyal1304
77cbc31ee9 Docs: Clean and slim the flowchart ...
in keyb-concepts
2022-07-22 07:55:24 -07:00
yashpalgoyal1304
63a9f4989a Docs: Bring the connected nodes together ...
in keyb-concepts
2022-07-22 07:55:24 -07:00
yashpalgoyal1304
b4b7d3069e Docs: Improve the order in this mermaid code ...
In keyb-concepts
2022-07-22 07:55:24 -07:00
yashpalgoyal1304
579b3e095b Docs: Merge the common action in the keyb-concepts 2022-07-22 07:55:24 -07:00
Wez Furlong
c22ee082ad docs: note about wezterm-gui.exe --help not outputting anything
closes: https://github.com/wez/wezterm/issues/1801
2022-07-22 07:52:31 -07:00
Wez Furlong
ca8bdb83bb wezterm cli spawn: update help and clap constraints
refs: #2248
2022-07-22 07:46:25 -07:00
Wez Furlong
0043d35eb6
revise bug report template
Add a box for gathering WM/compositor info.
Add log file locations to the logs section.
2022-07-22 07:08:16 -07:00
Wez Furlong
f70a3e0c9b quote pwd in open-wezterm-here
so that it will work for locations that have spaces in their names.

refs: #2103
2022-07-22 06:46:21 -07:00
Wez Furlong
397bddbf6b deploy: don't try to strip a shell script 2022-07-21 22:57:55 -07:00
Wez Furlong
60d7d214c1 Add open-wezterm-here script
The .deb package registers that script as the alternative for
a terminal emulator in the hope that various "open terminal here..."
functions in other tools will use that to detect wezterm and run
thing in the cwd.

refs: https://github.com/wez/wezterm/issues/2103
2022-07-21 22:34:54 -07:00
Wez Furlong
743ab695e8 rustfmt 2022-07-21 19:45:49 -07:00
Wez Furlong
0b1ab8c6e0 update shell completions for wezter show-keys subcommand 2022-07-21 19:44:26 -07:00
Wez Furlong
2b3d8c1a30 wezterm cli: --workspace requires --new-window
so have the arg parser raise an error if used without it:

```
; wezterm cli spawn --workspace foo
error: The following required arguments were not provided:
    --new-window

USAGE:
    wezterm cli spawn --new-window --workspace <WORKSPACE>

For more information try --help
```

refs: https://github.com/wez/wezterm/issues/2248#issuecomment-1192119746
2022-07-21 19:44:16 -07:00
Wez Furlong
34f87a9be5 add ClearScrollback example that adds CTRL-L after clearing
refs: https://github.com/wez/wezterm/issues/2290
2022-07-21 19:35:52 -07:00
Wez Furlong
67ae0e021f fix tab x button being obscured by tab title text
Need to explicitly pop it in front of the tab text layer so that
the button is physically rendered on top of the tab title.

refs: https://github.com/wez/wezterm/issues/2269
2022-07-21 18:51:21 -07:00
digitallyserviced
41ee60c97a add gelatyx to verify-pages workflow 2022-07-20 07:45:34 -07:00
Wez Furlong
50d5f94ab0 color schemes: add alias concept
Various color schemes have been duplicated as they have been added to
different scheme collections.  They don't always have identical names
(eg: some remove spaces) and sometimes they have very different names
(eg: _bash vs. nightfox, or Miu vs. Blazer).

We already detected duplicates from different collections but previously
we would omit those dupes.

This commit allows us to track those duplicates by recording their
aliases.

When we write out our data, we only include "interesting" alias names;
those where the name isn't trivially identical.

Some scheme collections (eg: iterm2 color schemes) have duplicates
(eg: zenbones and zenbones_light are identical) and we have previously
shipped with both of those names, so we special case to emit dupes
for which we have prior version information in order to avoid
breaking backwards compatibility for our users.

In the doc generation we can generate links to the aliases if we
included them, but also note about the other names and how we don't
include them.  That is so that someone searching the docs for say
"_bash" can discover that it is actually a duplicate of "nightfox" and
use nightfox instead.
2022-07-20 07:32:46 -07:00
Wez Furlong
ffb6ea76cd sync nightfox color schemes
note that "_bash (Gogh)" is removed by this as it is actually
a duplicate of nightfox but with a different name, according
to my dedup logic.

I may add a way to express aliases as a followup.

refs: https://github.com/EdenEast/nightfox.nvim/pull/184
refs: https://github.com/EdenEast/nightfox.nvim/issues/183
refs: https://github.com/EdenEast/nightfox.nvim/issues/156
2022-07-20 05:40:06 -07:00
Wez Furlong
badfae7d23 gui-startup event now accepts SpawnCommand
This allows the hook to choose how to handle eg: `wezterm start -- top`.
Previously, if you had implemented this event you would essentially lose
the ability to specify a command that you wanted to launch.

refs: https://github.com/wez/wezterm/issues/284
2022-07-19 19:45:27 -07:00
Wez Furlong
77b6870ff3 config: revert taking name from the first comment line of toml color scheme files
I needed this while swinging through to the new color scheme data stuff,
but I don't need it any more, and it causes problems with external toml
files.
2022-07-19 12:02:23 -07:00
Wez Furlong
ec59fb6597 docs: changelog for #2253 #2273 2022-07-19 08:00:26 -07:00
Wez Furlong
e0ea0f46a8 docs: apply stylua formatting
refs: https://github.com/wez/wezterm/pull/2273
refs: https://github.com/wez/wezterm/issues/2253
2022-07-19 07:54:31 -07:00
Wez Furlong
7bd41772ab docs: fix lua syntax 2022-07-19 07:35:52 -07:00
Wez Furlong
98dd864df1 docs: split MuxPane 2022-07-19 07:20:11 -07:00
Wez Furlong
f5ee95d582 docs: fix lua syntax issues 2022-07-19 07:12:25 -07:00
Wez Furlong
713450156c docs: only try to format tracked files
Don't format generated docs; their inputs should be formatted instead.

refs: https://github.com/wez/wezterm/pull/2273
refs: https://github.com/wez/wezterm/issues/2253
2022-07-19 06:58:22 -07:00
azzamsa
be929db374 docs: reformat lua code
refs: https://github.com/wez/wezterm/pull/2273
refs: https://github.com/wez/wezterm/issues/2253
2022-07-19 06:27:33 -07:00
Wez Furlong
aee66daccb key table activation timeout is now reset on matching key presses
refs: https://github.com/wez/wezterm/issues/1129
2022-07-19 06:18:26 -07:00
Wez Furlong
112feb3374 add MuxTab:set_zoomed and SetPaneZoomState keyassignment
refs: #2284
2022-07-19 05:52:38 -07:00
Wez Furlong
d15fd7b4db docs: fix parameters to call_after callback 2022-07-18 12:35:36 -07:00
Wez Furlong
dd327617b1 lua: add wezterm.time.call_after and wezterm.reload_configuration
These allow setting up some basic timers and constructing time-dependent
config files.

Needs to be used respsonsibly!
2022-07-18 07:37:41 -07:00
Wez Furlong
c81dabd76b rustfmt 2022-07-17 21:55:39 -07:00
Wez Furlong
1c32ac95bf cargo update
and address deprecation warnings for csscolorparser
2022-07-17 21:14:47 -07:00
Wez Furlong
85fb78d788 lua: add wezterm.time and Time object
Includes a method for determining sunrise/sunset.
2022-07-17 11:38:02 -07:00
Wez Furlong
2b17a64d74 docs: changelog for #2103 #2271 2022-07-17 05:54:18 -07:00
Anomalocaridid
4e2b5cd2cd add --cwd . to desktop file Exec field 2022-07-17 05:50:28 -07:00
Anomalocaridid
a56904e40d change exec command in desktop file 2022-07-17 05:50:28 -07:00
Wez Furlong
fc6cfd1f72 term: fix encoding for modified F1-F4
refs: https://github.com/wez/wezterm/issues/2263
2022-07-16 22:12:26 -07:00
Wez Furlong
5e60743519 lua: add wezterm.procinfo module 2022-07-16 08:49:58 -07:00
Wez Furlong
ec65b64f30 lua: add tostring impls for window, tab and pane objects 2022-07-16 08:22:10 -07:00
Wez Furlong
4e4371a312 docs: clarify what happens when appearance changes 2022-07-16 07:40:48 -07:00