commit bash-20150717 snapshot

This commit is contained in:
Chet Ramey
2015-07-29 16:16:37 -04:00
parent bce12dd773
commit 58a975cb0c
21 changed files with 243 additions and 40 deletions
+2 -2
View File
@@ -114,8 +114,8 @@ enum filetype
arg_directory
};
/* Prefix color, currently same as directory */
#define C_PREFIX C_DIR
/* Prefix color, currently same as socket */
#define C_PREFIX C_SOCK
extern void _rl_put_indicator (const struct bin_str *ind);
extern void _rl_set_normal_color (void);
+29 -16
View File
@@ -128,7 +128,7 @@ static int get_y_or_n PARAMS((int));
static int _rl_internal_pager PARAMS((int));
static char *printable_part PARAMS((char *));
static int fnwidth PARAMS((const char *));
static int fnprint PARAMS((const char *, int));
static int fnprint PARAMS((const char *, int, const char *));
static int print_filename PARAMS((char *, char *, int));
static char **gen_completion_matches PARAMS((char *, int, int, rl_compentry_func_t *, int, int));
@@ -212,6 +212,8 @@ int rl_visible_stats = 0;
completions. The colors used are taken from $LS_COLORS, if set. */
int _rl_colored_stats = 0;
/* Non-zero means to use a color (currently magenta) to indicate the common
prefix of a set of possible word completions. */
int _rl_colored_completion_prefix = 1;
#endif
@@ -798,9 +800,10 @@ fnwidth (string)
#define ELLIPSIS_LEN 3
static int
fnprint (to_print, prefix_bytes)
fnprint (to_print, prefix_bytes, real_pathname)
const char *to_print;
int prefix_bytes;
const char *real_pathname;
{
int printed_len, w;
const char *s;
@@ -819,10 +822,17 @@ fnprint (to_print, prefix_bytes)
printed_len = common_prefix_len = 0;
/* Don't print only the ellipsis if the common prefix is one of the
possible completions */
if (to_print[prefix_bytes] == '\0')
possible completions. Only cut off prefix_bytes if we're going to be
printing the ellipsis, which takes precedence over coloring the
completion prefix (see print_filename() below). */
if (_rl_completion_prefix_display_length > 0 && to_print[prefix_bytes] == '\0')
prefix_bytes = 0;
#if defined (COLOR_SUPPORT)
if (_rl_colored_stats && (prefix_bytes == 0 || _rl_colored_completion_prefix <= 0))
colored_stat_start (real_pathname);
#endif
if (prefix_bytes && _rl_completion_prefix_display_length > 0)
{
char ellipsis;
@@ -893,13 +903,23 @@ fnprint (to_print, prefix_bytes)
}
if (common_prefix_len > 0 && (s - to_print) >= common_prefix_len)
{
#if defined (COLOR_SUPPORT)
/* printed bytes = s - to_print */
/* printed bytes should never be > but check for paranoia's sake */
colored_prefix_end ();
if (_rl_colored_stats)
colored_stat_start (real_pathname); /* XXX - experiment */
#endif
common_prefix_len = 0;
}
}
#if defined (COLOR_SUPPORT)
/* XXX - unconditional for now */
if (_rl_colored_stats)
colored_stat_end ();
#endif
return printed_len;
}
@@ -920,7 +940,7 @@ print_filename (to_print, full_pathname, prefix_bytes)
/* Defer printing if we want to prefix with a color indicator */
if (_rl_colored_stats == 0 || rl_filename_completion_desired == 0)
#endif
printed_len = fnprint (to_print, prefix_bytes);
printed_len = fnprint (to_print, prefix_bytes, to_print);
if (rl_filename_completion_desired && (
#if defined (VISIBLE_STATS)
@@ -989,13 +1009,10 @@ print_filename (to_print, full_pathname, prefix_bytes)
extension_char = '/';
}
/* Move colored-stats code inside fnprint() */
#if defined (COLOR_SUPPORT)
if (_rl_colored_stats)
{
colored_stat_start (new_full_pathname);
printed_len = fnprint (to_print, prefix_bytes);
colored_stat_end ();
}
printed_len = fnprint (to_print, prefix_bytes, new_full_pathname);
#endif
xfree (new_full_pathname);
@@ -1012,15 +1029,11 @@ print_filename (to_print, full_pathname, prefix_bytes)
if (_rl_complete_mark_directories && path_isdir (s))
extension_char = '/';
/* Move colored-stats code inside fnprint() */
#if defined (COLOR_SUPPORT)
if (_rl_colored_stats)
{
colored_stat_start (s);
printed_len = fnprint (to_print, prefix_bytes);
colored_stat_end ();
}
printed_len = fnprint (to_print, prefix_bytes, s);
#endif
}
xfree (s);
+1 -1
View File
@@ -405,7 +405,7 @@ replace_history_entry (which, line, data)
WHICH >= 0 means to replace that particular history entry's data, as
long as it matches OLD. */
void
replace_history_data (which, old, new)
_hs_replace_history_data (which, old, new)
int which;
histdata_t *old, *new;
{
+8
View File
@@ -91,6 +91,13 @@ extern void add_history_time PARAMS((const char *));
elements are numbered from 0. */
extern HIST_ENTRY *remove_history PARAMS((int));
/* Allocate a history entry consisting of STRING and TIMESTAMP and return
a pointer to it. */
extern HIST_ENTRY *alloc_history_entry PARAMS((char *, char *));
/* Copy the history entry H, but not the (opaque) data pointer */
extern HIST_ENTRY *copy_history_entry PARAMS((HIST_ENTRY *));
/* Free the history entry H and return any application-specific data
associated with it. */
extern histdata_t free_history_entry PARAMS((HIST_ENTRY *));
@@ -241,6 +248,7 @@ extern char **history_tokenize PARAMS((const char *));
extern int history_base;
extern int history_length;
extern int history_max_entries;
extern int history_offset;
extern int history_lines_read_from_file;
extern int history_lines_written_to_file;
+3 -3
View File
@@ -151,7 +151,7 @@ static int running_in_emacs;
#endif
/* Flags word encapsulating the current readline state. */
int rl_readline_state = RL_STATE_NONE;
unsigned long rl_readline_state = RL_STATE_NONE;
/* The current offset in the current input line. */
int rl_point;
@@ -846,7 +846,7 @@ _rl_dispatch_subseq (key, map, got_subseq)
/* Special case rl_do_lowercase_version (). */
if (func == rl_do_lowercase_version)
/* Should we do anything special if key == ANYOTHERKEY? */
return (_rl_dispatch (_rl_to_lower (key), map));
return (_rl_dispatch (_rl_to_lower ((unsigned char)key), map));
rl_executing_keymap = map;
rl_executing_key = key;
@@ -1022,7 +1022,7 @@ _rl_subseq_result (r, map, key, got_subseq)
type = m[ANYOTHERKEY].type;
func = m[ANYOTHERKEY].function;
if (type == ISFUNC && func == rl_do_lowercase_version)
r = _rl_dispatch (_rl_to_lower (key), map);
r = _rl_dispatch (_rl_to_lower ((unsigned char)key), map);
else if (type == ISFUNC)
{
/* If we shadowed a function, whatever it is, we somehow need a
+1 -1
View File
@@ -493,7 +493,7 @@ extern int rl_readline_version; /* e.g., 0x0402 */
extern int rl_gnu_readline_p;
/* Flags word encapsulating the current readline state. */
extern int rl_readline_state;
extern unsigned long rl_readline_state;
/* Says which editing mode readline is currently using. 1 means emacs mode;
0 means vi mode. */
+3 -3
View File
@@ -50,7 +50,7 @@
#include "rlprivate.h"
#include "xmalloc.h"
extern void replace_history_data PARAMS((int, histdata_t *, histdata_t *));
extern void _hs_replace_history_data PARAMS((int, histdata_t *, histdata_t *));
/* Non-zero tells rl_delete_text and rl_insert_text to not add to
the undo list. */
@@ -129,7 +129,7 @@ rl_free_undo_list ()
orig_list = rl_undo_list;
_rl_free_undo_list (rl_undo_list);
rl_undo_list = (UNDO_LIST *)NULL;
replace_history_data (-1, (histdata_t *)orig_list, (histdata_t *)NULL);
_hs_replace_history_data (-1, (histdata_t *)orig_list, (histdata_t *)NULL);
}
UNDO_LIST *
@@ -245,7 +245,7 @@ rl_do_undo ()
xfree (temp);
}
replace_history_data (-1, (histdata_t *)release, (histdata_t *)rl_undo_list);
_hs_replace_history_data (-1, (histdata_t *)release, (histdata_t *)rl_undo_list);
xfree (release);
}