20 #pragma warning(disable : 4668)
23 #if !defined(ENABLE_VIRTUAL_TERMINAL_PROCESSING)
24 #define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
26 #if !defined(DISABLE_NEWLINE_AUTO_RETURN)
27 #define DISABLE_NEWLINE_AUTO_RETURN 0x0008
29 #if !defined(ENABLE_VIRTUAL_TERMINAL_INPUT)
30 #define ENABLE_VIRTUAL_TERMINAL_INPUT 0x0200
38 static bool enabled{
false};
40 static UINT out_code_page{0};
41 static UINT in_code_page{0};
62 const std::size_t moved{cursor_after.column() - cursor_before.column()};
64 rem.reserve(moved * 3);
65 for(std::size_t i = 0; i != moved; ++i) { rem +=
"\b \b"; }
80 static bool enabled{
false};
82 static DWORD originalOut{0};
83 static DWORD originalIn{0};
89 DWORD out{originalOut};
109 static termios orig_termios;
134 return static_cast<std::size_t
>(ENABLE_MOUSE_INPUT);
143 return static_cast<std::size_t
>(ENABLE_MOUSE_INPUT);
152 return static_cast<std::size_t
>(ENABLE_WINDOW_INPUT);
161 return static_cast<std::size_t
>(ENABLE_WINDOW_INPUT);
169 static bool activated{
false};
171 static DWORD flags{0};
182 send &= ~(ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_PROCESSED_INPUT);
187 send |= (ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_PROCESSED_INPUT);
197 static ::termios raw = {};
201 raw.c_cflag &= ~static_cast<std::size_t>(CSIZE | PARENB);
208 ::termios send = raw;
211 send.c_iflag &= ~static_cast<std::size_t>(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON | INPCK);
216 send.c_lflag &= ~static_cast<std::size_t>(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
void throw_exception(const std::string &str={}) const
Errno & check_if(const bool &ret) noexcept
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