Add 'terminal_synchronized' ui_option to opt-in synchronized output
Synchronized output does not work well with various terminals (including the linux console). It should also be unnecessary when not going through a slow link. This will eventually be removed if it is not proven to be useful to some users.
This commit is contained in:
parent
5d497dc46e
commit
428ddeb97b
|
@ -360,15 +360,19 @@ are exclusively available to built-in options.
|
||||||
Function key from which shifted function key start, if the
|
Function key from which shifted function key start, if the
|
||||||
terminal sends F13 for <s-F1>, this should be set to 12.
|
terminal sends F13 for <s-F1>, this should be set to 12.
|
||||||
|
|
||||||
*ncurses_padding_char*:::
|
*terminal_padding_char*:::
|
||||||
character used to indicate the area out of the displayed buffer
|
character used to indicate the area out of the displayed buffer
|
||||||
(defaults to '~')
|
(defaults to '~')
|
||||||
|
|
||||||
*ncurses_padding_fill*:::
|
*terminal_padding_fill*:::
|
||||||
if *yes* or *true*, fill the padding area with the padding character
|
if *yes* or *true*, fill the padding area with the padding character
|
||||||
instead of displaying a single character at the beginning of the
|
instead of displaying a single character at the beginning of the
|
||||||
padding line (defaults to *false*)
|
padding line (defaults to *false*)
|
||||||
|
|
||||||
|
*terminal_synchronize*:::
|
||||||
|
if *yes* or *true*, emit iterm2 synchronized output escape sequences
|
||||||
|
during redraw to reduce flickering (defaults to *false*)
|
||||||
|
|
||||||
[[startup-info]]
|
[[startup-info]]
|
||||||
*startup_info_version* `int`::
|
*startup_info_version* `int`::
|
||||||
_default_ 0 +
|
_default_ 0 +
|
||||||
|
|
|
@ -221,13 +221,14 @@ void TerminalUI::Screen::set_face(const Face& face)
|
||||||
m_active_face = face;
|
m_active_face = face;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TerminalUI::Screen::output(bool force)
|
void TerminalUI::Screen::output(bool force, bool synchronized)
|
||||||
{
|
{
|
||||||
if (lines.empty())
|
if (lines.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// iTerm2 "begin synchronised update" sequence
|
// iTerm2 "begin synchronized update" sequence
|
||||||
printf("\033P=1s\033\\");
|
if (synchronized)
|
||||||
|
printf("\033P=1s\033\\");
|
||||||
|
|
||||||
if (force)
|
if (force)
|
||||||
{
|
{
|
||||||
|
@ -304,8 +305,9 @@ void TerminalUI::Screen::output(bool force)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// iTerm2 "endsynchronised update" sequence
|
// iTerm2 "end synchronized update" sequence
|
||||||
printf("\033P=2s\033\\");
|
if (synchronized)
|
||||||
|
printf("\033P=2s\033\\");
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr int TerminalUI::default_shift_function_key;
|
constexpr int TerminalUI::default_shift_function_key;
|
||||||
|
@ -450,7 +452,7 @@ void TerminalUI::redraw(bool force)
|
||||||
|
|
||||||
m_info.blit(m_screen);
|
m_info.blit(m_screen);
|
||||||
|
|
||||||
m_screen.output(force);
|
m_screen.output(force, m_synchronized);
|
||||||
|
|
||||||
auto set_cursor_pos = [](DisplayCoord c) {
|
auto set_cursor_pos = [](DisplayCoord c) {
|
||||||
printf("\033[%d;%dH", (int)c.line + 1, (int)c.column + 1);
|
printf("\033[%d;%dH", (int)c.line + 1, (int)c.column + 1);
|
||||||
|
@ -1387,17 +1389,14 @@ void TerminalUI::set_ui_options(const Options& options)
|
||||||
m_assistant = ConstArrayView<StringView>{};
|
m_assistant = ConstArrayView<StringView>{};
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
auto get_boolean_option = [&](StringView name, bool default_value) {
|
||||||
auto it = options.find("terminal_status_on_top"_sv);
|
auto it = options.find(name);
|
||||||
m_status_on_top = it != options.end() and
|
return it == options.end() ? default_value
|
||||||
(it->value == "yes" or it->value == "true");
|
: (it->value == "yes" or it->value == "true");
|
||||||
}
|
};
|
||||||
|
|
||||||
{
|
m_status_on_top = get_boolean_option("terminal_status_on_top", false);
|
||||||
auto it = options.find("terminal_set_title"_sv);
|
m_set_title = get_boolean_option("terminal_set_title", true);
|
||||||
m_set_title = it == options.end() or
|
|
||||||
(it->value == "yes" or it->value == "true");
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
auto it = options.find("terminal_shift_function_key"_sv);
|
auto it = options.find("terminal_shift_function_key"_sv);
|
||||||
|
@ -1407,10 +1406,7 @@ void TerminalUI::set_ui_options(const Options& options)
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
auto enable_mouse_it = options.find("terminal_enable_mouse"_sv);
|
enable_mouse(get_boolean_option("terminal_enable_mouse", true));
|
||||||
enable_mouse(enable_mouse_it == options.end() or
|
|
||||||
enable_mouse_it->value == "yes" or
|
|
||||||
enable_mouse_it->value == "true");
|
|
||||||
|
|
||||||
auto wheel_up_it = options.find("terminal_wheel_up_button"_sv);
|
auto wheel_up_it = options.find("terminal_wheel_up_button"_sv);
|
||||||
m_wheel_up_button = wheel_up_it != options.end() ?
|
m_wheel_up_button = wheel_up_it != options.end() ?
|
||||||
|
@ -1437,11 +1433,8 @@ void TerminalUI::set_ui_options(const Options& options)
|
||||||
m_padding_char = it->value[0_char];
|
m_padding_char = it->value[0_char];
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
m_padding_fill = get_boolean_option("terminal_padding_fill", false);
|
||||||
auto it = options.find("terminal_padding_fill"_sv);
|
m_synchronized = get_boolean_option("terminal_synchronized", false);
|
||||||
m_padding_fill = it != options.end() and
|
|
||||||
(it->value == "yes" or it->value == "true");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ private:
|
||||||
|
|
||||||
struct Screen : Window
|
struct Screen : Window
|
||||||
{
|
{
|
||||||
void output(bool force);
|
void output(bool force, bool synchronized);
|
||||||
void set_face(const Face& face);
|
void set_face(const Face& face);
|
||||||
|
|
||||||
Vector<size_t> hashes;
|
Vector<size_t> hashes;
|
||||||
|
@ -152,6 +152,7 @@ private:
|
||||||
int m_shift_function_key = default_shift_function_key;
|
int m_shift_function_key = default_shift_function_key;
|
||||||
|
|
||||||
bool m_set_title = true;
|
bool m_set_title = true;
|
||||||
|
bool m_synchronized = false;
|
||||||
|
|
||||||
Codepoint m_padding_char = '~';
|
Codepoint m_padding_char = '~';
|
||||||
bool m_padding_fill = false;
|
bool m_padding_fill = false;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user