Set mode raw/cooked.
First call is to save the good state set-up by cpp-terminal.
169{
170 static bool activated{false};
171#if defined(_WIN32)
172 static DWORD flags{0};
173 if(!activated)
174 {
177 activated = true;
178 return;
179 }
180 DWORD send = flags;
182 {
183 send &= ~(ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_PROCESSED_INPUT);
185 }
187 {
188 send |= (ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_PROCESSED_INPUT);
190 }
195#else
197 {
198 static ::termios raw = {};
199 if(!activated)
200 {
202 raw.c_cflag &= ~static_cast<std::size_t>(CSIZE | PARENB);
203 raw.c_cflag |= CS8;
204 raw.c_cc[VMIN] = 1;
205 raw.c_cc[VTIME] = 0;
206 activated = true;
207 return;
208 }
209 ::termios send = raw;
211 {
212 send.c_iflag &= ~static_cast<std::size_t>(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON | INPCK);
213
214
215
216
217 send.c_lflag &= ~static_cast<std::size_t>(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
220 }
222 {
223 send = raw;
226 }
230 }
231#endif
232}
bool has(const Option &option) const noexcept
void throw_exception(const std::string &str={}) const
Errno & check_if(const bool &ret) noexcept
static std::size_t setFocusEvents()
static std::size_t setMouseEvents()
@ 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...