mirror of
https://github.com/p-ranav/indicators.git
synced 2025-12-16 04:18:51 +08:00
setting console mode to processed output not neccesary if we use SetConsoleCursorPosition
This commit is contained in:
@@ -14,12 +14,6 @@ namespace indicators {
|
|||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
|
|
||||||
void enable_cursor_movement() {
|
|
||||||
auto hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
|
|
||||||
SetConsoleMode(hStdout,
|
|
||||||
ENABLE_PROCESSED_OUTPUT | ENABLE_VIRTUAL_TERMINAL_PROCESSING);
|
|
||||||
}
|
|
||||||
|
|
||||||
void show_console_cursor(bool const show) {
|
void show_console_cursor(bool const show) {
|
||||||
HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);
|
HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
|
|
||||||
@@ -32,8 +26,6 @@ void show_console_cursor(bool const show) {
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
void enable_cursor_movement() {}
|
|
||||||
|
|
||||||
void show_console_cursor(bool const show) {
|
void show_console_cursor(bool const show) {
|
||||||
std::fputs(show ? "\e[?25h" : "\e[?25l", stdout);
|
std::fputs(show ? "\e[?25h" : "\e[?25l", stdout);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
#include <indicators/cursor_control.hpp>
|
#include <indicators/cursor_control.hpp>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
indicators::enable_cursor_movement();
|
|
||||||
indicators::show_console_cursor(false);
|
indicators::show_console_cursor(false);
|
||||||
|
|
||||||
indicators::ProgressBar bar1{indicators::option::BarWidth{50},
|
indicators::ProgressBar bar1{indicators::option::BarWidth{50},
|
||||||
|
|||||||
Reference in New Issue
Block a user