Check terminfo for ts capability to determine title setting support

This commit is contained in:
Gregory Anders 2023-09-29 13:33:06 -05:00 committed by Fabian Boehm
parent ff8a79a823
commit 33c6eee9d2
3 changed files with 7 additions and 0 deletions

View file

@ -62,6 +62,7 @@ Completions
Improved terminal support
^^^^^^^^^^^^^^^^^^^^^^^^^
- Fish now checks for the ``ts`` capability in terminfo to determine if a terminal supports setting the window title.
Other improvements
------------------

View file

@ -118,6 +118,7 @@ pub struct Term {
pub set_a_background: Option<CString>,
pub set_background: Option<CString>,
pub exit_attribute_mode: Option<CString>,
pub set_title: Option<CString>,
// Number capabilities
pub max_colors: Option<i32>,
@ -145,6 +146,7 @@ impl Term {
set_a_background: get_str_cap("AB"),
set_background: get_str_cap("Sb"),
exit_attribute_mode: get_str_cap("me"),
set_title: get_str_cap("ts"),
// Number capabilities
max_colors: get_num_cap("Co"),

View file

@ -612,6 +612,10 @@ fn does_term_support_setting_title(vars: &EnvStack) -> bool {
};
let term: &wstr = term.as_ref();
if curses::term().is_some_and(|term| term.set_title.is_some()) {
return true;
}
let recognized = TITLE_TERMS.contains(&term)
|| term.starts_with(L!("xterm-"))
|| term.starts_with(L!("screen-"))