1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-29 10:04:49 +03:00
Commit Graph

620 Commits

Author SHA1 Message Date
Wez Furlong
1d4d6df045
color-types: prep for crates.io publish 2024-01-27 12:16:47 -07:00
Wez Furlong
f472a5abfb
wezterm-dynamic: bump version of crates.io publish
Not sure if it is strictly necessary to do this, but stuff
has changed since the last publish.
2024-01-27 12:09:16 -07:00
Mikko Perttunen
12a6b8df84 termwiz: surface: Fix cursor movement in DiffState
DiffState keeps track of a virtual cursor in order to skip emitting
cursor location changes when a previous text change has already moved
the cursor to the desired position. However, currently the code always
advances the cursor by 1 column for each added text change regardless
of the width of the text.

Fix behavior by advancing the cursor by the width of the text.
To avoid having to add a new variable, make 'self.cursor' contain
the cursor position for the next cell instead of the current cell.

In addition, add a test verifying the behavior.
2024-01-23 06:42:13 -07:00
Mikko Perttunen
ec0cb7ce1b termwiz: surface: Fix cell diffing in presence of wide cells
The present code for creating diffs between surface regions processes
visible cells from both surfaces in lockstep. This only works when
the cells at each position have the same width in each surface.
When widths differ, the iterators go out of sync and end up comparing
cells in different positions of the surface, resulting in incorrect
diffs.

Fix this by instead iterating over the source surface ('other'), and
for each cell locating the corresponding cell in the target surface
to compare against.

To apply the fix to all three diffing functions, outline the per-line
code to a new function and call it in each function.

Also add a test that verifies the behavior in such case with differing
cell widths.
2024-01-23 06:42:13 -07:00
Wez Furlong
5e9688bd4e
Update Symbols Nerd Font Mono to 3.1.1
Procedure is:

* Download the `NerdFontsSymbolsOnly.zip` release asset
* Extract the font into assets/fonts
* Run the codegen to update nerdfonts_data.rs:
  `cd termwiz/codgen ; cargo run`
* Apply formatting: `cd ../../ ; cargo +nightly fmt`
* Update the list of symbols in the docs:
  * edit `docs/config/lua/wezterm/nerdfonts.md`
  * delete the table
  * Run the embedded vim command that will regenerate the table

refs: https://github.com/wez/wezterm/pull/4656
2024-01-21 16:25:04 -07:00
Wez Furlong
ba85958a61
deps: update env-logger
Note that we are pinned on 0.10 for env-bootstrap, where we use it
only for its module filter parser.
2024-01-20 16:01:10 -07:00
Gregory Anders
960538c267 wezterm.terminfo: add terminator to Sync capability
I'm not sure if this is strictly necessary, but according to the
terminfo specification [1], a conditional string should be terminated
with `%;`.

[1]: https://man7.org/linux/man-pages/man5/terminfo.5.html
2023-12-02 08:51:00 -07:00
Jun Wu
2a022399bb Fallback to SGR when rendering 16/256 colors when MaxColors is 16M
When MaxColors is 16M, the "palette index" is treated by "setaf" as a true color, not the classic 256 color. Users of `PaletteIndex` expects 256 color and let's fallback to SGR.

For example, setaf on tmux-direct is:

    setaf=\E[%?%p1%{8}%<%t3%p1%d%e38:2::%p1%{65536}%/%d:%p1%{256}%/%{255}%&%d:%p1%{255}%&%d%;m,

It only special treats the first 8 colors (which means `rgb(0,0,0..8)` cannot be rendered with `setaf`).
2023-11-04 06:13:07 -07:00
Jun Wu
3f1a120074 Detect true color set by max_colors
Terminals like `xterm-direct` has max_colors set to 16M. They should be treated as supporting true colors.
2023-11-04 06:12:08 -07:00
Wez Furlong
c75f20f21c
deps: ordered-float -> 4.1.0
closes: https://github.com/wez/wezterm/pull/4338
2023-09-28 14:39:22 -07:00
Wez Furlong
6198e3dcc9
termwiz: TeenyString: use heap string when col width > 2
This isn't currently possible, but
https://github.com/wez/wezterm/issues/4223 will introduce that
possibility.  This commit causes width > 2 to "overflow" into
the heap-stored variant.

Sequences that are long enough to produce a column width > 2 are
likely to already be long enough in bytes to overlow into the
heap-stored variant anyway.
2023-09-28 11:13:59 -07:00
Wez Furlong
33e727b074
Respond to DECRQM 2027 - grapheme clustering
closes: https://github.com/wez/wezterm/issues/4320
2023-09-20 14:48:05 -07:00
Ovidiu Ionescu
9c215e15fd
fix: issue 3935 handle F13-F24 (#3937)
* fix: issue 3935 handle F13-F24

* Added F13-F24 in kitty mode

* fix: replace trailing ~ with u in escape sequence

* fix: patch ending char for function keys

---------

Co-authored-by: Ovidiu Ionescu <ovidiu@ionescu.net>
2023-08-06 10:22:14 -07:00
Wez Furlong
2a7167a0ef
fix some warnings 2023-08-06 09:18:40 -07:00
Wez Furlong
d1d4db20be
cargo update
Transitive deps now require rust 1.71, so update for that, as well
as some other minor changes required by transitive deps.
2023-07-30 20:09:15 -07:00
Wez Furlong
822a766761
conpty: adjust screensize probing
We need a delay, and to be able to swallow a couple of
excess xtversion responses in order to read the pixel
dimension response.
2023-07-16 08:46:45 -07:00
Wez Furlong
e2c9c60acd
termwiz: fix windows build 2023-07-16 07:02:12 -07:00
Wez Furlong
feb9e11b33
termwiz: refactor terminal probing
Factor out the probe_screen_size method from the Terminal
trait and put it into a ProbeCapabilities struct.

This makes it easier to introduce other sorts of probed
information without making the Terminal trait grow all sorts
of additional methods.

A Terminal may choose not to support probing, which it cannot
if it doesn't have Read + Write handles to an underlying terminal
(such as some special cases in wezterm).
2023-07-16 06:53:17 -07:00
Wez Furlong
b7771feef6
imgcat: work better with tmux and conpty
Neither of these understand image protocols, and both are
an additional processing layer between the application and
wezterm.

This commit detects and wraps OSC sequences in tmux's passthru
sequence so that the data is passed on to wezterm rather than
elided from the data stream.

For image protocols in both tmux and conpty, work a little
smarter and explicitly move the cursor position to the same
location that wezterm would move it to.  That prevents the
display from being as mangled by tmux/conpty due to a diverging
understanding of the cursor position.

The logic isn't perfect, and can result in the x-coordinate
being incorrect, and this won't work with the new --position
argument either in its current state, without adding a lot
of complexity to deal with scrolling and relative and absolute
positioning handling.

To facilitate that, a new termwiz Terminal trait method has
been added to probe the terminal name, version, cell and pixel
dimensions. It's not pretty.

refs: https://github.com/wez/wezterm/issues/3624
refs: https://github.com/wez/wezterm/issues/3716
2023-07-15 22:13:19 -07:00
Wez Furlong
18e4b9bad1
termwiz: windows: speculative build fix
01fe53f20a didn't consider this
case for windows
2023-07-06 14:07:33 -07:00
Wez Furlong
01fe53f20a
ssh: use double height text for host key failure case
That makes it really stand out

refs: #3941
2023-07-06 12:53:05 -07:00
Chris Pick
35df422ec7 Remove typo in hyperlink URL
The trailing 'A' lead to a 404, remove it.
2023-07-03 13:06:20 -07:00
Wez Furlong
71819b4abc
more fallout from Nerd Font symbols breaking changes in 3.0 2023-05-28 20:08:21 -07:00
Wez Furlong
e4b96bd9bb
update Symbols Nerd Font Mono to v3.0.1 2023-05-21 09:34:10 -07:00
cairijun
2428282b42 fix encoding Tab with modifiers 2023-05-20 20:04:46 -07:00
Wez Furlong
6686adba04
fix panic with corrupt webp file
There were a couple of layers of issue here:

* In the ImageDataType::decode method, we didn't detect and do something
  reasonable when the decoded image had 0 frames, later leading to
  a panic in glyphcache when trying to index frame 0 of an empty vec.
* We shouldn't have been using ImageDataType::decode for window
  background images
* Make the fallback/placeholder black rather than fully transparent
  in the more modern decoder thread routine that we use for image
  decoding at the gui layer.

refs: #3614
2023-04-25 08:39:42 -07:00
Wez Furlong
040a079b82
termwiz: input: avoid panic for certain numpad keys
refs: #3543
2023-04-17 08:04:29 -07:00
Wez Furlong
2b9ee388e3
refactor: move encode_modifiers to Modifiers::encode_xterm 2023-04-15 19:27:57 -07:00
Wez Furlong
3c40846d95
keyboard: move led status to separate enum 2023-04-15 14:52:54 -07:00
Wez Furlong
36d9e13c81
refactor: dedup ctrl_mapping function 2023-04-13 14:25:47 -07:00
Wez Furlong
1f7ff31179
termwiz: ignore caps/num lock when encoding keys in xterm encoding
refs: https://github.com/wez/wezterm/issues/3517
2023-04-13 14:24:04 -07:00
Wez Furlong
7d66bc761d
termwiz::Modifiers is now wezterm_input_types::Modifiers 2023-04-13 14:18:13 -07:00
Wez Furlong
e241ea58be
kitty keeb: move encoding logic to wezterm-input-types
We need access to the underlying raw/physical key in order
to correctly encode in some modes, so we need the full KeyEvent
struct for that.

Move the encoder up so it sits alongside the win32 input mode
encoder.

This should give us better results for both shifted/unshifted
and the "base layout" (US english) representations of a number
of keys.

Note that this is still not 100% technically correct: the unshifted
keys require knowledge of the keyboard layout that we don't have
at this OS-independent layer.

Right now we're assuming a US layout to unshift punctuation, which
is not right if you're not using that layout.  To resolve that,
more work is needed on each OS to be able to extract that information
and then to store it in the KeyEvent.

refs: https://github.com/wez/wezterm/issues/3479
refs: https://github.com/wez/wezterm/issues/2546
2023-04-10 08:54:03 -07:00
Wez Furlong
54a65a5401
kitty keeb: adjust legacy encoding logic
Just consider all ascii alphanumeric and punctuation as legacy
so that we don't decide to encode those as escapes when not required.

refs: #3315
2023-04-09 21:53:46 -07:00
Wez Furlong
a9165ae4c4
kitty keeb: fixup tests
refs: #3315
2023-04-09 13:22:25 -07:00
Wez Furlong
b704ec6d70
kitty keyboard: improve mode 1 support
We don't need to encode as many keys in mode 1.

refs: #3315
2023-04-09 13:05:23 -07:00
Wez Furlong
f4995511e2
keyboard: improve support for numpad buttons
We were missing encoding of these for the base xterm encoding
(I haven't daily driven a keyboard with a numpad in over 10 years!).

Improve mapping for the kitty protocol.

refs: https://github.com/wez/wezterm/issues/3478
2023-04-09 12:28:30 -07:00
Wez Furlong
2dcf7ad98d
keyboard: plumb more modifier+state information through
This commit teaches the termwiz layer about positional modifiers,
and expands our modifier concept to also pass through led states
such as caps lock and num lock.

Those aren't actually keyboard modifiers, but the state is useful
to recognize.

Adjust the shift key normalization so that we don't uppercase
alpha characters when both SHIFT and CAPS_LOCK are held.
This processing will remove both SHIFT and CAPS_LOCK in that
situation.

Add a method to KeyEvent that will undo the OS keyboard layer
normalization of positional to generic modifier key presses.
eg: the OS may map LeftControl -> Control, but we actually
prefer to have LeftControl so if we can unambiguously reverse
that mapping, we do so.

refs: #3476
refs: #3475
2023-04-09 10:34:53 -07:00
Wez Furlong
397593be5c
kitty keeb: fixup shifted character encoding
refs: https://github.com/wez/wezterm/issues/3474
2023-04-08 20:01:10 -07:00
Wez Furlong
0540301121
kitty keeb: add test case for #2546
This passes, so I'm assuming that one of the other kitty
commits from today has resolved this.

refs: https://github.com/wez/wezterm/issues/2546
2023-04-08 19:28:22 -07:00
Wez Furlong
8bb39bd6f3
fixup kitty keyup events for alphabetical keys
refs: https://github.com/wez/wezterm/issues/3220
2023-04-08 19:19:27 -07:00
Wez Furlong
d239e65e64
fixup kitty keyboard encoding for F1-F4
refs: https://github.com/wez/wezterm/issues/3473
2023-04-08 18:19:07 -07:00
Wez Furlong
7b40f01054
switch to fancy-regex crate
Enables back references and look around assertions for quick select
and hyper link rules

refs: https://github.com/wez/wezterm/issues/3247
2023-04-07 17:39:00 -07:00
Jalil David Salamé Messina
6dd8a98ff3 fix: Derive Eq on Selection 2023-03-27 07:38:55 -07:00
Jalil David Salamé Messina
2315834109 fix: Use serde with bitflags 2023-03-27 07:38:55 -07:00
Jalil David Salamé Messina
c2f63c296b fix: Formatting 2023-03-27 07:38:55 -07:00
Jalil David Salamé Messina
fc5e8b4f3d fix: Update signal-hook to 0.3 and fix compilation errors
- Some functions are now under the `low_level` module, use that
2023-03-27 07:38:55 -07:00
Jalil David Salamé Messina
344f133608 chore: Update criterion to 0.4 2023-03-27 07:38:55 -07:00
Jalil David Salamé Messina
05df6ec054 chore: Update nix to 0.26 2023-03-27 07:38:55 -07:00
Jalil David Salamé Messina
7f89f46ae5 fix: Update bitflags to 2.0 and fix compilation errors
- v2.0 no longer derives a bunch of traits (Debug, Clone, Copy, PartialEq, Eq)
  by default, so I manually derived them.
- It also changed the snapshot results so I updated them:

  An empty bitflags struct is no longer displayed as `None` but as
  `BitFlags(0x0)`.

- `bits` is no longer a field but a method so I added the missing
  parenthesis.
2023-03-27 07:38:55 -07:00