From af4bf379bc20ce4d9c7884e9bc94bef4689ee118 Mon Sep 17 00:00:00 2001 From: jdfa Date: Tue, 16 Mar 2021 10:46:02 +0200 Subject: [PATCH] Swapped order of hidding cursor and setting alternative screen (#75) On some terminal, going to the alternative screen disable cursor hiding. Swap of those commands fixed that issue. Co-authored-by: d --- src/ftxui/component/screen_interactive.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ftxui/component/screen_interactive.cpp b/src/ftxui/component/screen_interactive.cpp index cf53dde..4c486bf 100644 --- a/src/ftxui/component/screen_interactive.cpp +++ b/src/ftxui/component/screen_interactive.cpp @@ -250,6 +250,11 @@ void ScreenInteractive::Loop(Component* component) { install_signal_handler(SIGWINCH, OnResize); #endif + if (use_alternative_screen_) { + std::cout << USE_ALTERNATIVE_SCREEN; + on_exit_functions.push([] { std::cout << USE_NORMAL_SCREEN; }); + } + // Hide the cursor and show it at exit. std::cout << HIDE_CURSOR; std::cout << DISABLE_LINE_WRAP; @@ -264,11 +269,6 @@ void ScreenInteractive::Loop(Component* component) { auto event_listener = std::thread(&EventListener, &quit_, event_receiver_->MakeSender()); - if (use_alternative_screen_) { - std::cout << USE_ALTERNATIVE_SCREEN; - on_exit_functions.push([] { std::cout << USE_NORMAL_SCREEN; }); - } - // The main loop. while (!quit_) { if (!event_receiver_->HasPending()) {