\t & % work again

This commit is contained in:
anon 2023-08-04 19:56:50 +02:00
parent 6098604d92
commit aedf547a66
3 changed files with 19 additions and 15 deletions

View File

@ -476,17 +476,24 @@ display(void)
void void
horswp_field(void){ horswp_field(void){
if(current_window != &wresult){ if(current_window != &wresult){
if(current_window == &winput){
window_change |= CH_INPUT;
}else{
window_change |= CH_MODE;
}
last_window = current_window; last_window = current_window;
current_window = &wresult; current_window = &wresult;
}else{ }else{
current_window = last_window; current_window = last_window;
} }
window_change |= CH_RESULT;
} }
void void
verswp_field(void){ verswp_field(void){
if(current_window == &wresult){ return; } if(current_window == &wresult){ return; }
current_window = (current_window == &winput) ? &wmode : &winput; current_window = (current_window == &winput) ? &wmode : &winput;
window_change |= CH_INPUT | CH_MODE;
} }
/*ARGSUSED*/ /*ARGSUSED*/

View File

@ -397,6 +397,12 @@ wresult_input(const int c){
static int static int
global_input(const int c){ global_input(const int c){
switch(c){ switch(c){
case '\t':
horswp_field();
break;
case '%':
verswp_field();
break;
case ' ': /* display next page */ case ' ': /* display next page */
case '+': case '+':
case ctrl('V'): case ctrl('V'):
@ -466,7 +472,7 @@ global_input(const int c){
//// } //// }
////} ////}
////clearprompt(); ////clearprompt();
return(NO); /* return to the previous field */ break;
case '<': /* read lines from a file */ case '<': /* read lines from a file */
break; // XXX break; // XXX
move(PRLINE, 0); move(PRLINE, 0);
@ -536,7 +542,7 @@ global_input(const int c){
case ctrl('L'): /* redraw screen */ case ctrl('L'): /* redraw screen */
case KEY_CLEAR: case KEY_CLEAR:
window_change = CH_ALL; window_change = CH_ALL;
return(NO); break;
case '?': /* help */ case '?': /* help */
clear(); clear();
help(); help();
@ -546,9 +552,11 @@ global_input(const int c){
case ctrl('E'): /* edit all lines */ case ctrl('E'): /* edit all lines */
editall(); editall();
break; break;
default:
return 0;
} }
return 0; return 1;
} }
extern const void const* winput; extern const void const* winput;
@ -560,7 +568,7 @@ int
handle_input(const char c){ handle_input(const char c){
/* --- global --- */ /* --- global --- */
const int r = global_input(c); const int r = global_input(c);
if(r){ return r; } if(r){ return 0; }
/* --- mode specific --- */ /* --- mode specific --- */
if(*current_window == winput){ if(*current_window == winput){
return interpret(c); return interpret(c);

View File

@ -37,14 +37,6 @@ static void callback_handler(char* line){
search(); search();
} }
static int horswp_field_proxy(int i, int h){
horswp_field();
}
static int verswp_field_proxy(int i, int h){
verswp_field();
}
static int interpret_break(){ static int interpret_break(){
do_terminate = YES; do_terminate = YES;
} }
@ -135,9 +127,6 @@ void rlinit(){
rl_redisplay_function = redisplay_function; rl_redisplay_function = redisplay_function;
rl_callback_handler_install("", callback_handler); rl_callback_handler_install("", callback_handler);
rl_bind_key('\t', horswp_field_proxy);
rl_bind_key('%', verswp_field_proxy);
rl_bind_key(EOF, interpret_break); rl_bind_key(EOF, interpret_break);
rl_bind_key(ctrl('D'), interpret_break); //XXX: why the fuck does it not work if its the first char? rl_bind_key(ctrl('D'), interpret_break); //XXX: why the fuck does it not work if its the first char?
rl_bind_key(ctrl('Z'), ctrl_z); rl_bind_key(ctrl('Z'), ctrl_z);