Closed HiImJulien closed 3 years ago
Step 1: Try idea 1 to 10 Step 2: Fail Step 3: Write issue Step 4: Try idea 11 Step 5: Succeed
In FTXUI/src/.../event.cpp
I found following line:
const Event Event::Tab = Event::Special({9});
I don't know why, but it didn't come to my mind to try Event::Special({16})
but everything else before.
For everyone stumbling upon this issue, scratching their head wondering what to do; do the following to estimate certain event codes:
print_key_press
( 27 91 68 )
. Which is the event code we need.auto myEvent = Event::Special({27, 91, 68})
Use this to detect this event; i.e.:
bool MyComponent::OnEvent(ftxui::Event ev) override
{
if(ev == myEvent)
doSomethingAwesome();
return true;
}
@ArthurSonzogni Can this be documented somewhere? Took my a while to understand this; especially with the comment
// Documentation:
// https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
which was a bit misleading.
Thanks!
Yes, it seems the characters map to:
ctrl: [a,z] -> [1,26] (With many edge case)
shift: [a,z] -> [65,90]
normal: [a,z] -> [97,123]
https://en.wikipedia.org/wiki/ASCII#Control_code_chart
I will update the documentation and talk about ./example/util/print_key_press
Hey there! First of all, in the past three hours, upon discovering this project, I started to fall in love with it and its design. ❤️ Well done!
For my project I'd like to open a modal upon pressing CTRL-P. The modal is pretty much what you expect: A fuzzy finder for commands.
However, I failed to determine which event to check for when processing events. The example
print_key_press
only prints:How can I detect that
CTRL-P
is being pressed?While I am at it; how about the other modifier keys?