From e98a604a2126b23468db50d64874b4d130cdbd4a Mon Sep 17 00:00:00 2001 From: axel Date: Thu, 26 Oct 2006 20:22:53 +1000 Subject: [PATCH] Minor edits, remove unneeded code, add a few commants, correct spelling, tweak the todo list, etc. darcs-hash:20061026102253-ac50b-eb42fdab9a9211d68386a563134856a96b870d90.gz --- builtin_set.c | 12 +++++++++--- common.h | 3 ++- doc_src/doc.hdr | 5 +++-- doc_src/function.txt | 1 - doc_src/isatty.txt | 2 +- env.h | 2 +- function.c | 2 -- halloc.h | 3 ++- parser.c | 12 ++++++++++-- screen.c | 3 ++- 10 files changed, 30 insertions(+), 15 deletions(-) diff --git a/builtin_set.c b/builtin_set.c index d8ab66bcf..650edf72d 100644 --- a/builtin_set.c +++ b/builtin_set.c @@ -318,20 +318,20 @@ static int al_contains_long( array_list_t *list, */ static void erase_values(array_list_t *list, array_list_t *indexes) { - int i; + long i; array_list_t result; al_init(&result); for (i = 0; i < al_get_count(list); i++) { - if (!al_contains_long(indexes, (long)i + 1)) + if (!al_contains_long(indexes, i + 1)) { al_push(&result, al_get(list, i)); } else { - free((void *) al_get(list, i)); + free( (void *)al_get(list, i)); } } @@ -375,16 +375,22 @@ static void print_variables(int include_values, int esc, int scope) shorten = 1; value = wcsndup( value, 60 ); if( !value ) + { DIE_MEM(); + } } + e_value = esc ? expand_escape_variable(value) : wcsdup(value); + sb_append2(sb_out, L" ", e_value, (void *)0); free(e_value); + if( shorten ) { sb_append(sb_out, L"\u2026"); free( value ); } + } } diff --git a/common.h b/common.h index f6cfcc0ac..1f31d5479 100644 --- a/common.h +++ b/common.h @@ -52,7 +52,8 @@ extern struct termios shell_modes; extern wchar_t ellipsis_char; /** - The verbosity of fish + The verbosity level of fish. If a call to debug has a severity + level higher than \c debug_level, it will not be printed. */ extern int debug_level; diff --git a/doc_src/doc.hdr b/doc_src/doc.hdr index e18e22f63..ca5cf1a95 100644 --- a/doc_src/doc.hdr +++ b/doc_src/doc.hdr @@ -1314,14 +1314,14 @@ g++, javac, java, gcj, lpr, doxygen, whois, find) - Autoreload inputrc-file on updates - Right-side prompt - Selectable completions in the pager -- Access to the whole history in $history -- Saving of the history in intervals to not loose to much on crashes - Per process output redirection - Reduce the space of the pager by one line to allow the commandline to remain visible. - down-arrow could be used to save the current command to the history. Or give the next command in-sequnce. Or both. - A pretty-printer. - Help messages for builtin should not be compiled into fish, they should be kept in a separate directory - Shellscript functions should be able to show help on the commandline instead of launching a browser +- Drop support for inputrc-files. Use shellscripts and the bind builtin. Also, redo the syntax for the bind builtin to something more sane. +- History could reload itself when the file is updated. This would need to be done in a clever way to avoid chain reactions \subsection bugs Known bugs @@ -1329,6 +1329,7 @@ g++, javac, java, gcj, lpr, doxygen, whois, find) - Suspending and then resuming pipelines containing a builtin is broken. How should this be handled? - screen handling code can't handle tabs in input + If you think you have found a bug not described here, please send a report to axel@liljencrantz.se . diff --git a/doc_src/function.txt b/doc_src/function.txt index 75bf9e889..7bf7ced20 100644 --- a/doc_src/function.txt +++ b/doc_src/function.txt @@ -5,7 +5,6 @@ \subsection function-description Description -- \c -b or \c --key-binding specifies that the function is a key biding. Key binding functions work exactly like regular functions except that they can not be tab-completed. - -d DESCRIPTION or \c --description=DESCRIPTION is a description of what the function does, suitable as a completion description - -j PID or --on-job-exit PID tells fish to run this function when the job with group id PID exits. Instead of PID, the string 'caller' can be specified. This is only legal when in a command substitution, and will result in the handler being triggered by the exit of the job which created this command substitution. - -p PID or --on-process-exit PID tells fish to run this function when the fish child process with process id PID exits diff --git a/doc_src/isatty.txt b/doc_src/isatty.txt index 5654c5a2b..4ec855e97 100644 --- a/doc_src/isatty.txt +++ b/doc_src/isatty.txt @@ -6,7 +6,7 @@ where FILE DESCRIPTOR may be either the number of a file descriptor, or one of the strings stdin, stdout and stderr. -If he specified file descriptor is a tty, the exit status of the +If the specified file descriptor is a tty, the exit status of the command is zero, otherwise, it is non-zero. diff --git a/env.h b/env.h index e192fde49..3297d5ad1 100644 --- a/env.h +++ b/env.h @@ -94,7 +94,7 @@ int env_set( const wchar_t *key, wchar_t *env_get( const wchar_t *key ); /** - Returns 1 if the specified key exists. This can't be reliable done + Returns 1 if the specified key exists. This can't be reliably done using env_get, since env_get returns null for 0-element arrays \param key The name of the variable to remove diff --git a/function.c b/function.c index e10d64918..9f6105a4b 100644 --- a/function.c +++ b/function.c @@ -309,8 +309,6 @@ static void get_names_internal( void *key, void *aux ) { wchar_t *name = (wchar_t *)key; - function_data_t *f = (function_data_t *)val; - if( name[0] != L'_' && !al_contains_str( (array_list_t *)aux, name ) ) { al_push( (array_list_t *)aux, name ); diff --git a/halloc.h b/halloc.h index 584ed84cd..1cdf89c07 100644 --- a/halloc.h +++ b/halloc.h @@ -11,7 +11,8 @@ /** Allocate new memory using specified parent memory context. Context - _must_ be either 0 or the result of a previous call to halloc. + _must_ be either 0 or the result of a previous call to halloc. The + resulting memory is set to zero. If \c context is null, the resulting block is a root block, and must be freed with a call to halloc_free(). diff --git a/parser.c b/parser.c index 93f676e19..5533ebfb5 100644 --- a/parser.c +++ b/parser.c @@ -1642,8 +1642,16 @@ static void parse_job_main_loop( process_t *p, return; } - - +/* +static void print_block_stack( block_t *b ) +{ + if( !b ) + return; + print_block_stack( b->outer ); + + debug( 0, L"Block type %ls, skip: %d", parser_get_block_desc( b->type ), b->skip ); +} +*/ /** Fully parse a single job. Does not call exec on it, but any command substitutions in the job will be executed. diff --git a/screen.c b/screen.c index 2a0873c97..4c6d0e64d 100644 --- a/screen.c +++ b/screen.c @@ -285,9 +285,10 @@ static void s_check_status( screen_t *s) to repaint. However, we do not know where the cursor is. It is our best bet that we are still on the same line, so we move to the beginning of the line, reset the modelled screen - contents, and then set the modeled curor y-pos to its + contents, and then set the modeled cursor y-pos to its earlier value. */ + int prev_line = s->actual_cursor[1]; write( 1, "\r", 1 ); s_reset( s );