Vitali Pomanitski
Vitali Pomanitski

Reputation: 21

binding return and esc keys in curses library (in perl)

In order to bind the CTRL+Q key using Perl's Curses library, it'll be :

$cui->set_binding( sub {exit 0;}, "\cQ" );

How can I bind the ENTER and the ESC keys? Where can I find a good resource except for this one for those modules?

A good resource for Perl Curses::UI

Upvotes: 1

Views: 371

Answers (1)

starbelly
starbelly

Reputation: 254

To add to the original comment, the best resources in this case are going to be the distro's various module documentation, the source code, and the ncurses library. We can see here that esc and a few other keys are special cases.

As an example you would use the subroutine Curses::UI::Common::CUI_ESC() or "\x1B" as originally suggested.

We can see it in use here

One of the modules that seems to be quite relevant to this topic is Curses::UI::Widget

Upvotes: 4

Related Questions