Support UTF-8 character in tab name and pane name (#2102)

* Support UTF-8 character in tab name and pane name

* Support UTF-8 character in tab name and pane name
This commit is contained in:
哇呜哇呜呀咦耶 2023-01-19 21:28:04 +08:00 committed by GitHub
parent 04b294aabb
commit f9a7188728
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -1118,7 +1118,7 @@ impl Screen {
},
c => {
// It only allows printable unicode
if buf.iter().all(|u| matches!(u, 0x20..=0x7E)) {
if buf.iter().all(|u| matches!(u, 0x20..=0x7E | 0xA0..=0xFF)) {
active_tab.name.push_str(c);
}
},

View file

@ -2680,7 +2680,9 @@ impl Tab {
.with_context(err_context)?;
// It only allows printable unicode, delete and backspace keys.
let is_updatable = buf.iter().all(|u| matches!(u, 0x20..=0x7E | 0x08 | 0x7F));
let is_updatable = buf
.iter()
.all(|u| matches!(u, 0x20..=0x7E | 0xA0..=0xFF | 0x08 | 0x7F));
if is_updatable {
let s = str::from_utf8(&buf).with_context(err_context)?;
active_terminal.update_name(s);