mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 06:15:54 +08:00
Fix regression causing crash when we should clamp negative wcwidth
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
Fixes c41dbe455
(Also use control pictures for pager prefix,
2024-10-19).
Fixes #10836
This commit is contained in:
parent
373c5b1e14
commit
5e3fdf3320
|
@ -1953,11 +1953,11 @@ fn rendered_character(c: char) -> char {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn wcwidth_rendered_min_0(c: char) -> usize {
|
fn wcwidth_rendered_min_0(c: char) -> usize {
|
||||||
usize::try_from(wcwidth_rendered(c)).unwrap()
|
usize::try_from(wcwidth_rendered(c)).unwrap_or_default()
|
||||||
}
|
}
|
||||||
pub fn wcwidth_rendered(c: char) -> isize {
|
pub fn wcwidth_rendered(c: char) -> isize {
|
||||||
fish_wcwidth(rendered_character(c))
|
fish_wcwidth(rendered_character(c))
|
||||||
}
|
}
|
||||||
pub fn wcswidth_rendered(s: &wstr) -> isize {
|
pub fn wcswidth_rendered(s: &wstr) -> isize {
|
||||||
s.chars().map(|c| fish_wcwidth(rendered_character(c))).sum()
|
s.chars().map(wcwidth_rendered).sum()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user