mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-12-05 01:11:46 +08:00
Clear terminal output of interactive screen on resize if alternate screen not in use (#952)
Some checks failed
Build / Tests (gcc, gcov, Linux GCC, ubuntu-latest) (push) Failing after 45s
Build / documentation (push) Failing after 46s
Build / Tests (llvm, llvm-cov gcov, Linux Clang, ubuntu-latest) (push) Failing after 1m59s
Build / Tests (cl, Windows MSVC, windows-latest) (push) Has been cancelled
Build / Create release (push) Has been cancelled
Build / Build packages (build/ftxui*Darwin*, macos-latest) (push) Has been cancelled
Build / Build packages (build/ftxui*Linux*, ubuntu-latest) (push) Has been cancelled
Build / Build packages (build/ftxui*Win64*, windows-latest) (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Failing after 5m41s
Some checks failed
Build / Tests (gcc, gcov, Linux GCC, ubuntu-latest) (push) Failing after 45s
Build / documentation (push) Failing after 46s
Build / Tests (llvm, llvm-cov gcov, Linux Clang, ubuntu-latest) (push) Failing after 1m59s
Build / Tests (cl, Windows MSVC, windows-latest) (push) Has been cancelled
Build / Create release (push) Has been cancelled
Build / Build packages (build/ftxui*Darwin*, macos-latest) (push) Has been cancelled
Build / Build packages (build/ftxui*Linux*, ubuntu-latest) (push) Has been cancelled
Build / Build packages (build/ftxui*Win64*, windows-latest) (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Failing after 5m41s
This commit is contained in:
parent
0683285f01
commit
dfa461b46b
@ -858,6 +858,13 @@ void ScreenInteractive::Draw(Component component) {
|
||||
ResetCursorPosition();
|
||||
std::cout << ResetPosition(/*clear=*/resized);
|
||||
|
||||
// If the terminal width decrease, the terminal emulator will start wrapping
|
||||
// lines and make the display dirty. We should clear it completely.
|
||||
if ((dimx < dimx_) && !use_alternative_screen_) {
|
||||
std::cout << "\033[J"; // clear terminal output
|
||||
std::cout << "\033[H"; // move cursor to home position
|
||||
}
|
||||
|
||||
// Resize the screen if needed.
|
||||
if (resized) {
|
||||
dimx_ = dimx;
|
||||
|
Loading…
Reference in New Issue
Block a user