Skip output synchronization query when explicitly disabled
Some terminals misbehave when queried for output synchronization support, such as Windows Terminal as reported in https://github.com/mawww/kakoune/issues/5032 The relatively long response from a terminal which does support output-sync is also prone to getting torn over a slow link such as a serial console, causing stray input to the editor. In ui_options, the terminal_synchronized option controls the use of this feature, but unfortunately the query is unconditionally sent at startup even when this is set false. Skip the query at startup when terminal_synchronized is explicitly false. We query at most once per terminal in set_ui_options so the behaviour is correct both when kakoune is started with terminal_synchronized unset and when it is started with terminal_synchronized set false but this is later unset.
This commit is contained in:
parent
990e92a5f3
commit
32680e5d65
|
@ -1472,7 +1472,6 @@ void TerminalUI::setup_terminal()
|
|||
"\033[22t" // save the current window title
|
||||
"\033[?25l" // hide cursor
|
||||
"\033=" // set application keypad mode, so the keypad keys send unique codes
|
||||
"\033[?2026$p" // query support for synchronize output
|
||||
"\033[?2004h" // force enable bracketed-paste events
|
||||
);
|
||||
}
|
||||
|
@ -1542,6 +1541,10 @@ void TerminalUI::set_ui_options(const Options& options)
|
|||
auto synchronized = find("terminal_synchronized").map(to_bool);
|
||||
m_synchronized.set = (bool)synchronized;
|
||||
m_synchronized.requested = synchronized.value_or(false);
|
||||
if (not m_synchronized.queried and not m_synchronized.set) {
|
||||
write(STDOUT_FILENO, "\033[?2026$p");
|
||||
m_synchronized.queried = true;
|
||||
}
|
||||
|
||||
m_shift_function_key = find("terminal_shift_function_key").map(str_to_int_ifp).value_or(default_shift_function_key);
|
||||
|
||||
|
|
|
@ -157,6 +157,7 @@ private:
|
|||
|
||||
struct Synchronized
|
||||
{
|
||||
bool queried : 1;
|
||||
bool supported : 1;
|
||||
bool set : 1;
|
||||
bool requested : 1;
|
||||
|
|
Loading…
Reference in New Issue
Block a user