mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 05:53:59 +00:00
Minor comment updates and code tweaks in input code
darcs-hash:20071002092838-75c98-d98cf339d971128761f65f6878651bd7069f9f59.gz
This commit is contained in:
parent
8cd8c3002e
commit
dac2129048
2 changed files with 39 additions and 59 deletions
|
@ -461,7 +461,7 @@ static int builtin_commandline( wchar_t **argv )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sb_printf( sb_err,
|
sb_printf( sb_err,
|
||||||
_(L"%ls: Unknown readline function '%ls'\n"),
|
_(L"%ls: Unknown input function '%ls'\n"),
|
||||||
argv[0],
|
argv[0],
|
||||||
argv[i] );
|
argv[i] );
|
||||||
builtin_print_help( argv[0], sb_err );
|
builtin_print_help( argv[0], sb_err );
|
||||||
|
|
66
input.c
66
input.c
|
@ -1,10 +1,6 @@
|
||||||
/** \file input.c
|
/** \file input.c
|
||||||
|
|
||||||
Functions for reading a character of input from stdin, using the
|
Functions for reading a character of input from stdin.
|
||||||
inputrc information for key bindings.
|
|
||||||
|
|
||||||
The inputrc file format was invented for the readline library. The
|
|
||||||
implementation in fish is as of yet incomplete.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -109,7 +105,7 @@ typedef struct
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Names of all the readline functions supported
|
Names of all the input functions supported
|
||||||
*/
|
*/
|
||||||
static const wchar_t *name_arr[] =
|
static const wchar_t *name_arr[] =
|
||||||
{
|
{
|
||||||
|
@ -150,7 +146,7 @@ static const wchar_t *name_arr[] =
|
||||||
;
|
;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Description of each supported readline function
|
Description of each supported input function
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
static const wchar_t *desc_arr[] =
|
static const wchar_t *desc_arr[] =
|
||||||
|
@ -190,7 +186,7 @@ static const wchar_t *desc_arr[] =
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Internal code for each supported readline function
|
Internal code for each supported input function
|
||||||
*/
|
*/
|
||||||
static const wchar_t code_arr[] =
|
static const wchar_t code_arr[] =
|
||||||
{
|
{
|
||||||
|
@ -504,26 +500,31 @@ wint_t input_readch()
|
||||||
reader_interrupted();
|
reader_interrupted();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Search for sequence in various mapping tables
|
Search for sequence in mapping tables
|
||||||
*/
|
*/
|
||||||
|
|
||||||
while( 1 )
|
while( 1 )
|
||||||
{
|
{
|
||||||
|
input_mapping_t *generic = 0;
|
||||||
for( i=0; i<al_get_count( &mappings); i++ )
|
for( i=0; i<al_get_count( &mappings); i++ )
|
||||||
{
|
{
|
||||||
wint_t res = input_try_mapping( (input_mapping_t *)al_get( &mappings, i ));
|
input_mapping_t *m = (input_mapping_t *)al_get( &mappings, i );
|
||||||
|
wint_t res = input_try_mapping( m );
|
||||||
if( res )
|
if( res )
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
if( wcslen( m->seq) == 0 )
|
||||||
|
{
|
||||||
|
generic = m;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
No matching exact mapping, try to find generic mapping.
|
No matching exact mapping, try to find generic mapping.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for( i=0; i<al_get_count( &mappings); i++ )
|
if( generic )
|
||||||
{
|
|
||||||
input_mapping_t *m = (input_mapping_t *)al_get( &mappings, i );
|
|
||||||
if( wcslen( m->seq) == 0 )
|
|
||||||
{
|
{
|
||||||
wchar_t arr[2]=
|
wchar_t arr[2]=
|
||||||
{
|
{
|
||||||
|
@ -535,10 +536,9 @@ wint_t input_readch()
|
||||||
|
|
||||||
return input_exec_binding( m, arr );
|
return input_exec_binding( m, arr );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
No action to take on specified character, ignoer it
|
No action to take on specified character, ignore it
|
||||||
and move to next one.
|
and move to next one.
|
||||||
*/
|
*/
|
||||||
input_common_readch( 0 );
|
input_common_readch( 0 );
|
||||||
|
@ -659,7 +659,13 @@ static void input_terminfo_init()
|
||||||
TERMINFO_ADD(key_f18);
|
TERMINFO_ADD(key_f18);
|
||||||
TERMINFO_ADD(key_f19);
|
TERMINFO_ADD(key_f19);
|
||||||
TERMINFO_ADD(key_f20);
|
TERMINFO_ADD(key_f20);
|
||||||
/* TERMINFO_ADD(key_f21);
|
/*
|
||||||
|
I know of no key board with more than 20 function keys, so
|
||||||
|
adding the rest here makes very little sense, since it will
|
||||||
|
take up a lot of room in any listings, but with no benefit.
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
TERMINFO_ADD(key_f21);
|
||||||
TERMINFO_ADD(key_f22);
|
TERMINFO_ADD(key_f22);
|
||||||
TERMINFO_ADD(key_f23);
|
TERMINFO_ADD(key_f23);
|
||||||
TERMINFO_ADD(key_f24);
|
TERMINFO_ADD(key_f24);
|
||||||
|
@ -762,32 +768,6 @@ static void input_terminfo_init()
|
||||||
TERMINFO_ADD(key_suspend);
|
TERMINFO_ADD(key_suspend);
|
||||||
TERMINFO_ADD(key_undo);
|
TERMINFO_ADD(key_undo);
|
||||||
TERMINFO_ADD(key_up);
|
TERMINFO_ADD(key_up);
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
|
|
||||||
TERMINFO_ADD( key_down );
|
|
||||||
TERMINFO_ADD( key_up );
|
|
||||||
TERMINFO_ADD( key_left );
|
|
||||||
TERMINFO_ADD( key_right );
|
|
||||||
TERMINFO_ADD( key_dc );
|
|
||||||
TERMINFO_ADD( key_backspace );
|
|
||||||
TERMINFO_ADD( key_home );
|
|
||||||
TERMINFO_ADD( key_end );
|
|
||||||
TERMINFO_ADD( key_ppage );
|
|
||||||
TERMINFO_ADD( key_npage );
|
|
||||||
TERMINFO_ADD( key_clear );
|
|
||||||
TERMINFO_ADD( key_close );
|
|
||||||
TERMINFO_ADD( key_command );
|
|
||||||
TERMINFO_ADD( key_copy );
|
|
||||||
TERMINFO_ADD( key_create );
|
|
||||||
TERMINFO_ADD( key_dl );
|
|
||||||
TERMINFO_ADD( key_enter );
|
|
||||||
TERMINFO_ADD( key_undo );
|
|
||||||
TERMINFO_ADD( key_suspend );
|
|
||||||
TERMINFO_ADD( key_cancel );
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void input_terminfo_destroy()
|
static void input_terminfo_destroy()
|
||||||
|
|
Loading…
Reference in a new issue