mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
Remove the --key-binding switch for fish
darcs-hash:20061025202836-ac50b-682015e2f5830a85ff520e89b0a951ca9d2913dc.gz
This commit is contained in:
parent
12be24ef47
commit
dfa73c7cc1
6 changed files with 11 additions and 46 deletions
38
builtin.c
38
builtin.c
|
@ -215,10 +215,11 @@ static void builtin_print_help( wchar_t *cmd, string_buffer_t *b )
|
|||
|
||||
if( is_interactive && !builtin_out_redirect && b==sb_err)
|
||||
{
|
||||
|
||||
/* Interactive mode help to screen - only print synopsis if the rest won't fit */
|
||||
|
||||
int screen_height, lines;
|
||||
|
||||
|
||||
screen_height = common_get_height();
|
||||
lines = count_char( str, L'\n' );
|
||||
if( lines > 2*screen_height/3 )
|
||||
|
@ -1005,27 +1006,10 @@ static int builtin_functions( wchar_t **argv )
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
Test whether the specified string is a valid name for a keybinding
|
||||
*/
|
||||
static int wcsbindingname( wchar_t *str )
|
||||
{
|
||||
while( *str )
|
||||
{
|
||||
if( (!iswalnum(*str)) && (*str != L'-' ) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
str++;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
typedef struct function_data
|
||||
{
|
||||
wchar_t *name;
|
||||
wchar_t *description;
|
||||
int is_binding;
|
||||
array_list_t *events;
|
||||
}
|
||||
function_data_t;
|
||||
|
@ -1041,7 +1025,6 @@ static int builtin_function( wchar_t **argv )
|
|||
int argc = builtin_count_args( argv );
|
||||
int res=0;
|
||||
wchar_t *desc=0;
|
||||
int is_binding=0;
|
||||
array_list_t *events;
|
||||
int i;
|
||||
|
||||
|
@ -1057,10 +1040,6 @@ static int builtin_function( wchar_t **argv )
|
|||
L"description", required_argument, 0, 'd'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"key-binding", no_argument, 0, 'b'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"on-signal", required_argument, 0, 's'
|
||||
}
|
||||
|
@ -1093,7 +1072,7 @@ static int builtin_function( wchar_t **argv )
|
|||
|
||||
int opt = wgetopt_long( argc,
|
||||
argv,
|
||||
L"bd:s:j:p:v:h",
|
||||
L"d:s:j:p:v:h",
|
||||
long_options,
|
||||
&opt_index );
|
||||
if( opt == -1 )
|
||||
|
@ -1108,7 +1087,6 @@ static int builtin_function( wchar_t **argv )
|
|||
BUILTIN_ERR_UNKNOWN,
|
||||
argv[0],
|
||||
long_options[opt_index].name );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
|
||||
res = 1;
|
||||
break;
|
||||
|
@ -1117,10 +1095,6 @@ static int builtin_function( wchar_t **argv )
|
|||
desc=woptarg;
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
is_binding=1;
|
||||
break;
|
||||
|
||||
case 's':
|
||||
{
|
||||
int sig = wcs2sig( woptarg );
|
||||
|
@ -1252,7 +1226,7 @@ static int builtin_function( wchar_t **argv )
|
|||
return 0;
|
||||
|
||||
case '?':
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
|
||||
res = 1;
|
||||
break;
|
||||
|
||||
|
@ -1331,7 +1305,6 @@ static int builtin_function( wchar_t **argv )
|
|||
|
||||
d->name=halloc_wcsdup( current_block, argv[woptind]);
|
||||
d->description=desc?halloc_wcsdup( current_block, desc):0;
|
||||
d->is_binding = is_binding;
|
||||
d->events = events;
|
||||
|
||||
for( i=0; i<al_get_count( events ); i++ )
|
||||
|
@ -2542,8 +2515,7 @@ static void builtin_end_add_function_def( function_data_t *d )
|
|||
function_add( d->name,
|
||||
def,
|
||||
d->description,
|
||||
d->events,
|
||||
d->is_binding );
|
||||
d->events );
|
||||
|
||||
free( def );
|
||||
|
||||
|
|
10
function.c
10
function.c
|
@ -44,10 +44,6 @@ typedef struct
|
|||
Line where definition started
|
||||
*/
|
||||
int definition_offset;
|
||||
/**
|
||||
Flag for specifying functions which are actually key bindings
|
||||
*/
|
||||
int is_binding;
|
||||
|
||||
/**
|
||||
Flag for specifying that this function was automatically loaded
|
||||
|
@ -169,8 +165,7 @@ void function_destroy()
|
|||
void function_add( const wchar_t *name,
|
||||
const wchar_t *val,
|
||||
const wchar_t *desc,
|
||||
array_list_t *events,
|
||||
int is_binding )
|
||||
array_list_t *events )
|
||||
{
|
||||
int i;
|
||||
wchar_t *cmd_end;
|
||||
|
@ -188,7 +183,6 @@ void function_add( const wchar_t *name,
|
|||
cmd_end = d->cmd + wcslen(d->cmd)-1;
|
||||
|
||||
d->desc = desc?wcsdup( desc ):0;
|
||||
d->is_binding = is_binding;
|
||||
d->definition_file = intern(reader_current_filename());
|
||||
d->is_autoload = is_autoload;
|
||||
|
||||
|
@ -317,7 +311,7 @@ static void get_names_internal( void *key,
|
|||
wchar_t *name = (wchar_t *)key;
|
||||
function_data_t *f = (function_data_t *)val;
|
||||
|
||||
if( name[0] != L'_' && !f->is_binding && !al_contains_str( (array_list_t *)aux, name ) )
|
||||
if( name[0] != L'_' && !al_contains_str( (array_list_t *)aux, name ) )
|
||||
{
|
||||
al_push( (array_list_t *)aux, name );
|
||||
}
|
||||
|
|
|
@ -27,8 +27,7 @@ void function_destroy();
|
|||
void function_add( const wchar_t *name,
|
||||
const wchar_t *val,
|
||||
const wchar_t *desc,
|
||||
array_list_t *events,
|
||||
int is_binding );
|
||||
array_list_t *events );
|
||||
|
||||
/**
|
||||
Remove the function with the specified name.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# fish-users.
|
||||
#
|
||||
|
||||
function delete-or-exit --key-binding
|
||||
function delete-or-exit
|
||||
if test (commandline)
|
||||
commandline -f delete-char
|
||||
else
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
function nextd-or-forward-word --key-binding
|
||||
function nextd-or-forward-word
|
||||
if test -z (commandline)
|
||||
nextd
|
||||
else
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
function prevd-or-backward-word --key-binding
|
||||
function prevd-or-backward-word
|
||||
if test -z (commandline)
|
||||
prevd
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue