Change ncurses title logic, use hard coded \033]2;<title>\007 sequence
And add a ncurses_set_title ui option defaulting to true.
This commit is contained in:
parent
995a094471
commit
ea7f76f7f2
|
@ -727,6 +727,8 @@ Some options are built in Kakoune, and can be used to control it's behaviour:
|
||||||
modification is detected.
|
modification is detected.
|
||||||
* `ui_options`: colon separated list of key=value pairs that are forwarded to
|
* `ui_options`: colon separated list of key=value pairs that are forwarded to
|
||||||
the user interface implementation. The NCurses UI support the following options:
|
the user interface implementation. The NCurses UI support the following options:
|
||||||
|
- `ncurses_set_title`: if `yes` or `true`, the terminal emulator title will
|
||||||
|
be changed.
|
||||||
- `ncurses_status_on_top`: if `yes`, or `true` the status line will be placed
|
- `ncurses_status_on_top`: if `yes`, or `true` the status line will be placed
|
||||||
at the top of the terminal rather than at the bottom.
|
at the top of the terminal rather than at the bottom.
|
||||||
- `ncurses_assistant`: specify the nice assistant you get in info boxes, can
|
- `ncurses_assistant`: specify the nice assistant you get in info boxes, can
|
||||||
|
|
|
@ -413,16 +413,13 @@ void NCursesUI::draw_status(const DisplayLine& status_line,
|
||||||
draw_line(trimmed_mode_line, col, default_face);
|
draw_line(trimmed_mode_line, col, default_face);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* tsl = tigetstr((char*)"tsl");
|
if (m_set_title)
|
||||||
const char* fsl = tigetstr((char*)"fsl");
|
|
||||||
if (tsl != 0 and (ptrdiff_t)tsl != -1 and
|
|
||||||
fsl != 0 and (ptrdiff_t)fsl != -1)
|
|
||||||
{
|
{
|
||||||
String title;
|
String title = "\033]2;";
|
||||||
for (auto& atom : mode_line)
|
for (auto& atom : mode_line)
|
||||||
title += atom.content();
|
title += atom.content();
|
||||||
title += " - Kakoune";
|
title += " - Kakoune\007";
|
||||||
printf("%s%s%s", tsl, title.c_str(), fsl);
|
write(1, title.data(), (int)title.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
|
@ -930,10 +927,14 @@ void NCursesUI::set_ui_options(const Options& options)
|
||||||
|
|
||||||
{
|
{
|
||||||
auto it = options.find("ncurses_status_on_top");
|
auto it = options.find("ncurses_status_on_top");
|
||||||
if (it == options.end())
|
m_status_on_top = it != options.end() and
|
||||||
m_status_on_top = false;
|
(it->second == "yes" or it->second == "true");
|
||||||
else
|
}
|
||||||
m_status_on_top = it->second == "yes" or it->second == "true";
|
|
||||||
|
{
|
||||||
|
auto it = options.find("ncurses_set_title");
|
||||||
|
m_set_title = it == options.end() or
|
||||||
|
(it->second == "yes" or it->second == "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
@ -83,6 +83,8 @@ private:
|
||||||
int m_wheel_down_button = 2;
|
int m_wheel_down_button = 2;
|
||||||
int m_wheel_up_button = 4;
|
int m_wheel_up_button = 4;
|
||||||
|
|
||||||
|
bool m_set_title = true;
|
||||||
|
|
||||||
bool m_dirty = false;
|
bool m_dirty = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user