\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
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*/

View File

@ -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);

View File

@ -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);