From 34a03061fef52cf6880ec640786952a19ee1d84e Mon Sep 17 00:00:00 2001 From: Marcus Holland-Moritz Date: Tue, 27 Jun 2023 14:13:29 +0200 Subject: [PATCH] Remove set_cursor_state, let's not overcomplicate things for now --- include/dwarfs/console_writer.h | 2 -- include/dwarfs/terminal.h | 2 -- src/dwarfs/console_writer.cpp | 3 --- src/dwarfs/terminal.cpp | 15 --------------- 4 files changed, 22 deletions(-) diff --git a/include/dwarfs/console_writer.h b/include/dwarfs/console_writer.h index 30c458fb..8355685e 100644 --- a/include/dwarfs/console_writer.h +++ b/include/dwarfs/console_writer.h @@ -43,8 +43,6 @@ class console_writer : public logger { level_type threshold, display_mode mode = NORMAL, bool verbose = false); - ~console_writer(); - void write(level_type level, const std::string& output, char const* file, int line) override; diff --git a/include/dwarfs/terminal.h b/include/dwarfs/terminal.h index a19acbf4..35f2c75c 100644 --- a/include/dwarfs/terminal.h +++ b/include/dwarfs/terminal.h @@ -50,8 +50,6 @@ void setup_terminal(); bool stream_is_fancy_terminal(std::ostream& os); -bool set_cursor_state(bool enabled); - char const* terminal_color(termcolor color); std::string diff --git a/src/dwarfs/console_writer.cpp b/src/dwarfs/console_writer.cpp index c0c71325..3077e9ef 100644 --- a/src/dwarfs/console_writer.cpp +++ b/src/dwarfs/console_writer.cpp @@ -75,11 +75,8 @@ console_writer::console_writer(std::ostream& os, progress_mode pg_mode, } else { set_policy(); } - set_cursor_state(false); } -console_writer::~console_writer() { set_cursor_state(true); } - void console_writer::rewind() { if (!statebuf_.empty()) { int lines = 0; diff --git a/src/dwarfs/terminal.cpp b/src/dwarfs/terminal.cpp index d27a48f7..92229934 100644 --- a/src/dwarfs/terminal.cpp +++ b/src/dwarfs/terminal.cpp @@ -58,21 +58,6 @@ void WindowsEmulateVT100Terminal(DWORD std_handle) { } #endif -bool set_cursor_state(bool enabled [[maybe_unused]]) { - bool was_enabled = true; -#ifdef _WIN32 - auto hdl = ::GetStdHandle(STD_OUTPUT_HANDLE); - - ::CONSOLE_CURSOR_INFO cursorInfo; - - ::GetConsoleCursorInfo(hdl, &cursorInfo); - was_enabled = cursorInfo.bVisible; - cursorInfo.bVisible = enabled; - ::SetConsoleCursorInfo(hdl, &cursorInfo); -#endif - return was_enabled; -} - void setup_terminal() { #ifdef _WIN32 WindowsEmulateVT100Terminal(STD_OUTPUT_HANDLE);