The only way to reach the terminal inside a BufferedTerminal was
terminal(&mut self), so code holding a shared reference could not ask
it for anything, including its size. dimensions(), reached through
Deref<Target = Surface>, is the size of the cached surface and only
changes when check_for_resize is called.
terminal_ref(&self) is the shared-reference counterpart to terminal(),
so callers can use the now &self Terminal::get_screen_size to get the
real size.
No implementation needs mutable access to report the size. The Unix
version issues TIOCGWINSZ on the fd, the Windows version calls
GetConsoleScreenBufferInfo on the handle, and the mux and ssh
implementations copy a cached value.
The &mut requirement came from the UnixTty::get_size and
ConsoleOutputHandle::get_buffer_info helpers, which are both read-only
queries, so they take &self too.
This is a breaking change for implementors of Terminal. Callers are
unaffected, since &mut T coerces to &T.
The compiled terminfo is reduced to a single artifact that CI checks
against its text source, failing on any drift.
Tests load the embedded entry and cover an XTGETTCAP response.
Fixes a bunch of warnings like this:
```
warning: hiding a lifetime that's elided elsewhere is confusing
--> window/src/os/macos/window.rs:670:23
|
670 | fn display_handle(&self) -> Result<DisplayHandle, HandleError> {
| ^^^^^ ------------- the same lifetime is hidden here
| |
| the lifetime is elided here
|
= help: the same lifetime is referred to in inconsistent ways, making the signature confusing
= note: `#[warn(mismatched_lifetime_syntaxes)]` on by default
help: use `'_` for type paths
|
670 | fn display_handle(&self) -> Result<DisplayHandle<'_>, HandleError> {
| ++++
```
This lint was added in Rust 1.89: https://github.com/rust-lang/rust/issues/141787
This commit makes a number of parts of wezterm's core
parsing functionality no_std compatible, but requiring alloc.
In the no_std environment, several lookup tables that would
normally have been used to accelerate some operations are
not available and we instead fall back to an O(n) operation.
I'm not sure if applications are supposed to use "Smulx" and "Setulc" or
"Su". Among the terminals that implement XTGETTCAP, contour, foot, ghostty
and kitty advertize both (and XTerm neither).
"Su" is the one mentioned in the original documentation
https://sw.kovidgoyal.net/kitty/underlines/
It's a boolean capability but I'd argue that's even better since I don't
think the flexibility of string capabilities is needed. (Personally, all
I want to use it for is to answer "will this terminal break if I emit the
hardcoded \e[4:3m and \e[58:2::1:2:3m".
Include "Su" in wezterm's terminfo, for the benefit of XTGETTCAP users..
Updated the compiled database with
tic -x termwiz/data/wezterm.terminfo -o termwiz/data
Alternatively we could change the kitty documentation.
The tmux control code support depends on `pest`, which might be a
dependency that some projects won't need. This change makes it
optional with a Cargo feature. It's default on to maintain compatibility.
This is the same version that is captured in the lock file,
but that lock file doesn't get propagated through to eg: termwiz
when published on crates.io.
Let's be explicit that we need this version because 2.1 doesn't
compile the `continue` token in our pest file:
https://github.com/wezterm/wezterm/pull/6810#issuecomment-2739610838
These are not really expected to be used by most applications.
They are being added to the cell module to support some higher
level checks as part of trying to handle these wezterm issues
a bit better:
https://github.com/wezterm/wezterm/issues/1422https://github.com/wezterm/wezterm/issues/6637
These functions use the White_Space properties as defined by
the UCD version 16.
I'm using the trie form of the data here because I'm already
using the ucd-trie module on other properties. The dataset
for White_Space is quite small, and is probably fine to use
a binary search on the non-ucd form of the data, I just didn't
have an example of that code hanging around and didn't want
to have to get distracted debugging that; I somehow always
end up with an off-by-one somewhere when hooking up a binary
search for the first time!
This commit has no functional impact on termwiz or any
other crate in the wezterm repo.
There were two different overflows that could happen here when
resizing the terminal from a narrow width to a much wider width,
when the input consists of very very long logical lines.
The first was that we could overflow the maximum number of
cells in the ClusteredLine struct, which had u16 as its type.
The second, after changing u16 to u32, was the maximum length
of a run of cells with the same attribute.
The former could be fixed, preserving the smaller integer type,
by adjusting the API to allow it to return the overflow, but
that feels awkward and we could just increase the size of
the integer type.
The latter can be caught with an overflowing_add operation
and breaking the run in the overflow case.
That is what this commit does.
+bump codec version because this causes a small change
in the serialization of line data used by the mux
protocol.
refs: https://github.com/wezterm/wezterm/issues/6729
* feat: optionally disable non-matching text attributes in Quick Select
Add a configuration option
'disable_attributes_for_non_matching_text_in_quick_select' that disables
all attributes for non-matching text in Quick Select Mode.
The default value for
'disable_attributes_for_non_matching_text_in_quick_select' is false
This resolves the issue https://github.com/wezterm/wezterm/issues/4022
* docs: documentation for disabling attributes for non matching text in QuickSelect
Add documentation for the below configuration option:
- `disable_attributes_for_non_matching_text_in_quick_select`
* feat: display quick select label and match in bold
* refactor: fetch colors from existing reference to config
* fix: reset additional attributes for non matching text
Reset additional below mentioned attributes to default for non matching
text if the configuration option
disable-attributes-for-non-matching-text-in-quick-select-mode is true
- Italic
- Blink
- StrikeThrough
- Invisible
- Hyperlink
* fix: update attributes to reset
* feat: add reset_attributes function in termwiz cell
Add reset_attributes function in termwiz cell
Use the above function to reset cell attributes for the cell
* refactor: update method name to clear_attributes
* termwiz: update version because public method has been added
Update termwiz version because a new method 'reset_attributes' has been
added in termwiz/src/cell.rs
* fix: update get_lines method in quickselect to be same as with_lines_mut
* termwiz: simpler method name, implementation to clear cell attributes
Use simpler method name and implementation as per suggestion
https://github.com/wezterm/wezterm/pull/6683#discussion_r1966596988
* refactor: clear cell attributes for every line if flag is set
Clear attributes for every line if the configuration option
disable-attributes-for-non-matching-text-in-quick-select has been set
Partially implement changes mentioned in suggestion
https://github.com/wezterm/wezterm/pull/6683#discussion_r1966597826
* refactor: replace for loop with for_each method to iterate through cells
Partially implement changes mentioned in suggestion
https://github.com/wezterm/wezterm/pull/6683#discussion_r1966597826
* refactor: rename configuration option to quick_select_remove_styling
Rename option to remove styling in quick select from
'disable_attributes_for_non_matching_text_in_quick_select' to
'quick_select_remove_styling'
Implement changes mentioned in suggestion
https://github.com/wezterm/wezterm/pull/6683#discussion_r1966598496
* fix: remove bold attribute when displaying quick select label, match
This is in order to raise this in a separate PR
Suggestion mentioned here
https://github.com/wezterm/wezterm/pull/6683#issuecomment-2676394535
* docs: update documentation for quick_select_remove_styling
* termwiz: just bump minor part
Since the only change in termwiz is addition of a public method, it
should be forward compatible, so we can just bump the minor part
Apply changes mentioned in suggestion
https://github.com/wezterm/wezterm/pull/6683#discussion_r1966600258
* fix: clear attributes for each cell in all lines in get_lines method
Apply changes mentioned in suggestion
https://github.com/wezterm/wezterm/pull/6683#discussion_r1966848308
* fix: clear appdata for line after clearing attributes of each cell
Move call to clear appdata for line after the call to clear attributes
from each cell when configuration option 'quick_select_remove_styling'
is enabled
Apply changes mentioned in suggestion
https://github.com/wezterm/wezterm/pull/6683#discussion_r1966848015