21 #pragma warning(disable : 4668)
24 #if !defined(ENABLE_VIRTUAL_TERMINAL_PROCESSING)
25 #define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
27 #if !defined(DISABLE_NEWLINE_AUTO_RETURN)
28 #define DISABLE_NEWLINE_AUTO_RETURN 0x0008
30 #if !defined(ENABLE_VIRTUAL_TERMINAL_INPUT)
31 #define ENABLE_VIRTUAL_TERMINAL_INPUT 0x0200
39 static bool enabled{
false};
41 static UINT out_code_page{0};
42 static UINT in_code_page{0};
63 const std::size_t moved{cursor_after.
column() - cursor_before.column()};
65 rem.reserve(moved * 3);
66 for(std::size_t i = 0; i != moved; ++i) { rem +=
"\b \b"; }
81 static bool enabled{
false};
83 static DWORD originalOut{0};
84 static DWORD originalIn{0};
89 DWORD in{
static_cast<DWORD
>((originalIn & ~(ENABLE_QUICK_EDIT_MODE | setFocusEvents() | setMouseEvents())) | (ENABLE_EXTENDED_FLAGS))};
90 DWORD out{originalOut};
110 static termios orig_termios;
135 return static_cast<std::size_t
>(ENABLE_MOUSE_INPUT);
144 return static_cast<std::size_t
>(ENABLE_MOUSE_INPUT);
153 return static_cast<std::size_t
>(ENABLE_WINDOW_INPUT);
162 return static_cast<std::size_t
>(ENABLE_WINDOW_INPUT);
170 static bool activated{
false};
172 static DWORD flags{0};
183 send &= ~(ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_PROCESSED_INPUT);
184 send |= (setFocusEvents() | setMouseEvents());
188 send |= (ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_PROCESSED_INPUT);
189 send &= ~(setFocusEvents() | setMouseEvents());
198 static ::termios raw = {};
202 raw.c_cflag &= ~static_cast<std::size_t>(CSIZE | PARENB);
209 ::termios send = raw;
212 send.c_iflag &= ~static_cast<std::size_t>(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON | INPCK);
217 send.c_lflag &= ~static_cast<std::size_t>(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
std::size_t column() const
void throw_exception(const std::string &str={}) const
Errno & check_if(const bool &ret) noexcept
std::size_t write(const std::string &str) const
static void registerSigwinch()
static void unblockSigwinch()
static void blockSigwinch()
WindowsError & check_if(const bool &ret) noexcept
void throw_exception(const std::string &str=std::string()) const
void setMode() const
Set mode raw/cooked.
static void set_unset_utf8()
static void store_and_restore() noexcept
Store and restore the default state of the terminal.
static std::size_t setFocusEvents()
static std::size_t setMouseEvents()
static std::size_t unsetMouseEvents()
static std::size_t unsetFocusEvents()
@ Cooked
Set terminal in cooked mode.
@ Raw
Set terminal in raw mode.
@ NoSignalKeys
Disable the signal keys (Ctrl+C, etc...) will not be processed by the OS and will appears has standar...
@ SignalKeys
Enable the signal keys (Ctrl+C, etc...), if activated these keys will have their default OS behaviour...
Term::Cursor cursor_position()
#define DISABLE_NEWLINE_AUTO_RETURN
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING
#define ENABLE_VIRTUAL_TERMINAL_INPUT