Use iTerm2 "synchronised update" sequences around redraws.
In terminals that support it, this sequence causes the terminal to not redraw *its* output until the application has finished, reducing redraw flickering. The sequence is defined in: https://gitlab.com/gnachman/iterm2/-/wikis/synchronized-updates-spec ...and is apparently also supported by kitty and libVTE. Fixes #3482.
This commit is contained in:
parent
72271ce529
commit
e760f2df6b
|
@ -226,6 +226,9 @@ void TerminalUI::Screen::output(bool force)
|
||||||
if (lines.empty())
|
if (lines.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// iTerm2 "begin synchronised update" sequence
|
||||||
|
printf("\033P=1s\033\\");
|
||||||
|
|
||||||
struct Change { int keep; int add; int del; };
|
struct Change { int keep; int add; int del; };
|
||||||
Vector<Change> changes{Change{}};
|
Vector<Change> changes{Change{}};
|
||||||
auto new_hashes = lines | transform([](auto& line) { return hash_value(line.atoms); }) | gather<Vector>();
|
auto new_hashes = lines | transform([](auto& line) { return hash_value(line.atoms); }) | gather<Vector>();
|
||||||
|
@ -293,6 +296,9 @@ void TerminalUI::Screen::output(bool force)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// iTerm2 "endsynchronised update" sequence
|
||||||
|
printf("\033P=2s\033\\");
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr int TerminalUI::default_shift_function_key;
|
constexpr int TerminalUI::default_shift_function_key;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user