diff --git a/builtin.c b/builtin.c index 2dc81d8fc..ce216cdd5 100644 --- a/builtin.c +++ b/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; iname, def, d->description, - d->events, - d->is_binding ); + d->events ); free( def ); diff --git a/function.c b/function.c index 893c7792b..e10d64918 100644 --- a/function.c +++ b/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 ); } diff --git a/function.h b/function.h index 7ee12d61f..e40354035 100644 --- a/function.h +++ b/function.h @@ -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. diff --git a/share/functions/delete-or-exit.fish b/share/functions/delete-or-exit.fish index 3e030f799..395b8fbc5 100644 --- a/share/functions/delete-or-exit.fish +++ b/share/functions/delete-or-exit.fish @@ -5,7 +5,7 @@ # fish-users. # -function delete-or-exit --key-binding +function delete-or-exit if test (commandline) commandline -f delete-char else diff --git a/share/functions/nextd-or-forward-word.fish b/share/functions/nextd-or-forward-word.fish index 3407f6802..ca4996035 100644 --- a/share/functions/nextd-or-forward-word.fish +++ b/share/functions/nextd-or-forward-word.fish @@ -1,5 +1,5 @@ -function nextd-or-forward-word --key-binding +function nextd-or-forward-word if test -z (commandline) nextd else diff --git a/share/functions/prevd-or-backward-word.fish b/share/functions/prevd-or-backward-word.fish index e06a05a7b..5f22c266e 100644 --- a/share/functions/prevd-or-backward-word.fish +++ b/share/functions/prevd-or-backward-word.fish @@ -1,4 +1,4 @@ -function prevd-or-backward-word --key-binding +function prevd-or-backward-word if test -z (commandline) prevd else