mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-11-22 18:59:59 +08:00
Convert \r into \n (#350)
This resolves: https://github.com/ArthurSonzogni/FTXUI/issues/337
This commit is contained in:
parent
a254e36632
commit
3e28fd6520
@ -30,6 +30,9 @@ Element gaugeDirection(float ratio, GaugeDirection);
|
||||
- **bugfix** Container::Tab implements `Focusable()`.
|
||||
- **bugfix** Improved default implementations of ComponentBase `Focusable()` and
|
||||
`ActiveChild()` methods.
|
||||
- **bugfix** Automatically convert '\r' keys into '\n' for Linux programs that
|
||||
do not send the correct code for the return key, like the 'bind'.
|
||||
https://github.com/ArthurSonzogni/FTXUI/issues/337
|
||||
|
||||
2.0.0
|
||||
-----
|
||||
|
@ -58,11 +58,7 @@ const Event Event::ArrowDown = Event::Special("\x1B[B");
|
||||
const Event Event::Backspace = Event::Special({127});
|
||||
const Event Event::Delete = Event::Special("\x1B[3~");
|
||||
const Event Event::Escape = Event::Special("\x1B");
|
||||
#if defined(_WIN32)
|
||||
const Event Event::Return = Event::Special({13});
|
||||
#else
|
||||
const Event Event::Return = Event::Special({10});
|
||||
#endif
|
||||
const Event Event::Tab = Event::Special({9});
|
||||
const Event Event::TabReverse = Event::Special({27, 91, 90});
|
||||
const Event Event::F1 = Event::Special("\x1B[OP");
|
||||
|
@ -52,7 +52,14 @@ void TerminalInputParser::Send(TerminalInputParser::Output output) {
|
||||
return;
|
||||
|
||||
case SPECIAL:
|
||||
out_->Send(Event::Special(std::move(pending_)));
|
||||
// Microsoft's terminal uses a different new line character for the return
|
||||
// key. This also happens with linux with the `bind` command:
|
||||
// See https://github.com/ArthurSonzogni/FTXUI/issues/337
|
||||
// Here, we uniformize the new line character to `\n`.
|
||||
if (pending_ == "\r")
|
||||
out_->Send(Event::Special("\n"));
|
||||
else
|
||||
out_->Send(Event::Special(std::move(pending_)));
|
||||
pending_.clear();
|
||||
return;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user