diff options
author | James Booth <boothj5@gmail.com> | 2015-02-03 23:27:06 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-02-03 23:27:06 +0000 |
commit | 7ab301869f919ef815c7dbb024a7b19ceaec671f (patch) | |
tree | 0197614224e51736859827599a05e486c1260b6a /src | |
parent | 8b58eb68d302b6b7c2c6e6319daf8cb064c38d54 (diff) | |
download | profani-tty-7ab301869f919ef815c7dbb024a7b19ceaec671f.tar.gz |
Moved readline startup hook
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/inputwin.c | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c index f9e123c5..0ee1d721 100644 --- a/src/ui/inputwin.c +++ b/src/ui/inputwin.c @@ -326,6 +326,50 @@ _inp_win_handle_scroll(void) // Readline callbacks +static int +_inp_rl_startup_hook(void) +{ + rl_bind_keyseq("\\e1", _inp_rl_win1_handler); + rl_bind_keyseq("\\e2", _inp_rl_win2_handler); + rl_bind_keyseq("\\e3", _inp_rl_win3_handler); + rl_bind_keyseq("\\e4", _inp_rl_win4_handler); + rl_bind_keyseq("\\e5", _inp_rl_win5_handler); + rl_bind_keyseq("\\e6", _inp_rl_win6_handler); + rl_bind_keyseq("\\e7", _inp_rl_win7_handler); + rl_bind_keyseq("\\e8", _inp_rl_win8_handler); + rl_bind_keyseq("\\e9", _inp_rl_win9_handler); + rl_bind_keyseq("\\e0", _inp_rl_win0_handler); + + rl_bind_keyseq("\\eOP", _inp_rl_win1_handler); + rl_bind_keyseq("\\eOQ", _inp_rl_win2_handler); + rl_bind_keyseq("\\eOR", _inp_rl_win3_handler); + rl_bind_keyseq("\\eOS", _inp_rl_win4_handler); + rl_bind_keyseq("\\e[15~", _inp_rl_win5_handler); + rl_bind_keyseq("\\e[17~", _inp_rl_win6_handler); + rl_bind_keyseq("\\e[18~", _inp_rl_win7_handler); + rl_bind_keyseq("\\e[19~", _inp_rl_win8_handler); + rl_bind_keyseq("\\e[20~", _inp_rl_win9_handler); + rl_bind_keyseq("\\e[21~", _inp_rl_win0_handler); + +#ifdef PLATFORM_OSX + rl_bind_keyseq("\\e[1;9D", _inp_rl_altleft_handler); + rl_bind_keyseq("\\e[1;9C", _inp_rl_altright_handler); + rl_bind_keyseq("\\e\\e[5~", _inp_rl_altpageup_handler); + rl_bind_keyseq("\\e\\e[6~", _inp_rl_altpagedown_handler); +#else + rl_bind_keyseq("\\e[1;3D", _inp_rl_altleft_handler); + rl_bind_keyseq("\\e[1;3C", _inp_rl_altright_handler); + rl_bind_keyseq("\\e[5;3~", _inp_rl_altpageup_handler); + rl_bind_keyseq("\\e[6;3~", _inp_rl_altpagedown_handler); +#endif + rl_bind_keyseq("\\e[5~", _inp_rl_pageup_handler); + rl_bind_keyseq("\\e[6~", _inp_rl_pagedown_handler); + + rl_bind_key('\t', _inp_rl_tab_handler); + + return 0; +} + static void _inp_rl_linehandler(char *line) { @@ -481,47 +525,3 @@ _inp_rl_altpagedown_handler(int count, int key) ui_subwin_page_down(); return 0; } - -static int -_inp_rl_startup_hook(void) -{ - rl_bind_keyseq("\\e1", _inp_rl_win1_handler); - rl_bind_keyseq("\\e2", _inp_rl_win2_handler); - rl_bind_keyseq("\\e3", _inp_rl_win3_handler); - rl_bind_keyseq("\\e4", _inp_rl_win4_handler); - rl_bind_keyseq("\\e5", _inp_rl_win5_handler); - rl_bind_keyseq("\\e6", _inp_rl_win6_handler); - rl_bind_keyseq("\\e7", _inp_rl_win7_handler); - rl_bind_keyseq("\\e8", _inp_rl_win8_handler); - rl_bind_keyseq("\\e9", _inp_rl_win9_handler); - rl_bind_keyseq("\\e0", _inp_rl_win0_handler); - - rl_bind_keyseq("\\eOP", _inp_rl_win1_handler); - rl_bind_keyseq("\\eOQ", _inp_rl_win2_handler); - rl_bind_keyseq("\\eOR", _inp_rl_win3_handler); - rl_bind_keyseq("\\eOS", _inp_rl_win4_handler); - rl_bind_keyseq("\\e[15~", _inp_rl_win5_handler); - rl_bind_keyseq("\\e[17~", _inp_rl_win6_handler); - rl_bind_keyseq("\\e[18~", _inp_rl_win7_handler); - rl_bind_keyseq("\\e[19~", _inp_rl_win8_handler); - rl_bind_keyseq("\\e[20~", _inp_rl_win9_handler); - rl_bind_keyseq("\\e[21~", _inp_rl_win0_handler); - -#ifdef PLATFORM_OSX - rl_bind_keyseq("\\e[1;9D", _inp_rl_altleft_handler); - rl_bind_keyseq("\\e[1;9C", _inp_rl_altright_handler); - rl_bind_keyseq("\\e\\e[5~", _inp_rl_altpageup_handler); - rl_bind_keyseq("\\e\\e[6~", _inp_rl_altpagedown_handler); -#else - rl_bind_keyseq("\\e[1;3D", _inp_rl_altleft_handler); - rl_bind_keyseq("\\e[1;3C", _inp_rl_altright_handler); - rl_bind_keyseq("\\e[5;3~", _inp_rl_altpageup_handler); - rl_bind_keyseq("\\e[6;3~", _inp_rl_altpagedown_handler); -#endif - rl_bind_keyseq("\\e[5~", _inp_rl_pageup_handler); - rl_bind_keyseq("\\e[6~", _inp_rl_pagedown_handler); - - rl_bind_key('\t', _inp_rl_tab_handler); - - return 0; -} \ No newline at end of file |