Skip to content

Commit

Permalink
Minor comment updates and code tweaks in input code
Browse files Browse the repository at this point in the history
darcs-hash:20071002092838-75c98-d98cf339d971128761f65f6878651bd7069f9f59.gz
  • Loading branch information
liljencrantz committed Oct 2, 2007
1 parent 8cd8c30 commit dac2129
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 59 deletions.
6 changes: 3 additions & 3 deletions builtin_commandline.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,9 @@ static int builtin_commandline( wchar_t **argv )
else
{
sb_printf( sb_err,
_(L"%ls: Unknown readline function '%ls'\n"),
argv[0],
argv[i] );
_(L"%ls: Unknown input function '%ls'\n"),
argv[0],
argv[i] );
builtin_print_help( argv[0], sb_err );
return 1;
}
Expand Down
92 changes: 36 additions & 56 deletions input.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
/** \file input.c
Functions for reading a character of input from stdin, using the
inputrc information for key bindings.
The inputrc file format was invented for the readline library. The
implementation in fish is as of yet incomplete.
Functions for reading a character of input from stdin.
*/

Expand Down Expand Up @@ -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[] =
{
Expand Down Expand Up @@ -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[] =
Expand Down Expand Up @@ -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[] =
{
Expand Down Expand Up @@ -504,41 +500,45 @@ wint_t input_readch()
reader_interrupted();

/*
Search for sequence in various mapping tables
Search for sequence in mapping tables
*/

while( 1 )
{
input_mapping_t *generic = 0;
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 )
return res;
return res;

if( wcslen( m->seq) == 0 )
{
generic = m;
}

}

/*
No matching exact mapping, try to find generic mapping.
*/

for( i=0; i<al_get_count( &mappings); i++ )
{
input_mapping_t *m = (input_mapping_t *)al_get( &mappings, i );
if( wcslen( m->seq) == 0 )
{
wchar_t arr[2]=
{
0,
0
}
;
arr[0] = input_common_readch(0);

return input_exec_binding( m, arr );
}

if( generic )
{
wchar_t arr[2]=
{
0,
0
}
;
arr[0] = input_common_readch(0);

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.
*/
input_common_readch( 0 );
Expand Down Expand Up @@ -659,7 +659,13 @@ static void input_terminfo_init()
TERMINFO_ADD(key_f18);
TERMINFO_ADD(key_f19);
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_f23);
TERMINFO_ADD(key_f24);
Expand Down Expand Up @@ -762,32 +768,6 @@ static void input_terminfo_init()
TERMINFO_ADD(key_suspend);
TERMINFO_ADD(key_undo);
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()
Expand Down

0 comments on commit dac2129

Please sign in to comment.