diff --git a/src/display.c b/src/display.c index d59b9e4..1750a4a 100644 --- a/src/display.c +++ b/src/display.c @@ -476,17 +476,24 @@ display(void) void horswp_field(void){ if(current_window != &wresult){ + if(current_window == &winput){ + window_change |= CH_INPUT; + }else{ + window_change |= CH_MODE; + } last_window = current_window; current_window = &wresult; }else{ current_window = last_window; } + window_change |= CH_RESULT; } void verswp_field(void){ if(current_window == &wresult){ return; } current_window = (current_window == &winput) ? &wmode : &winput; + window_change |= CH_INPUT | CH_MODE; } /*ARGSUSED*/ diff --git a/src/input.c b/src/input.c index 798c57c..ea26d10 100644 --- a/src/input.c +++ b/src/input.c @@ -397,6 +397,12 @@ wresult_input(const int c){ static int global_input(const int c){ switch(c){ + case '\t': + horswp_field(); + break; + case '%': + verswp_field(); + break; case ' ': /* display next page */ case '+': case ctrl('V'): @@ -466,7 +472,7 @@ global_input(const int c){ //// } ////} ////clearprompt(); - return(NO); /* return to the previous field */ + break; case '<': /* read lines from a file */ break; // XXX move(PRLINE, 0); @@ -536,7 +542,7 @@ global_input(const int c){ case ctrl('L'): /* redraw screen */ case KEY_CLEAR: window_change = CH_ALL; - return(NO); + break; case '?': /* help */ clear(); help(); @@ -546,9 +552,11 @@ global_input(const int c){ case ctrl('E'): /* edit all lines */ editall(); break; + default: + return 0; } - return 0; + return 1; } extern const void const* winput; @@ -560,7 +568,7 @@ int handle_input(const char c){ /* --- global --- */ const int r = global_input(c); - if(r){ return r; } + if(r){ return 0; } /* --- mode specific --- */ if(*current_window == winput){ return interpret(c); diff --git a/src/readline.c b/src/readline.c index 2a92974..7e9f45d 100644 --- a/src/readline.c +++ b/src/readline.c @@ -37,14 +37,6 @@ static void callback_handler(char* line){ 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(){ do_terminate = YES; } @@ -135,9 +127,6 @@ void rlinit(){ rl_redisplay_function = redisplay_function; 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(ctrl('D'), interpret_break); //XXX: why the fuck does it not work if its the first char? rl_bind_key(ctrl('Z'), ctrl_z);