minor fixes; readline API change for rl_completer_word_break_characters ; readline fixes for MSVC

This commit is contained in:
Chet Ramey
2021-08-19 15:48:31 -04:00
parent cf8298cb22
commit 2adf06d9f8
13 changed files with 68 additions and 18 deletions
+38
View File
@@ -1709,3 +1709,41 @@ lib/sh/unicode.c
siglist.c
- include command.h before general.h for PARAMS and prototypes. Report
from Osipov, Michael (LDA IT PLM) <michael.osipov@siemens.com>
8/18
----
lib/readline/colors.c
- S_ISBLK: make sure it's defined before we use it, like in complete.c
lib/readline/complete.c,{bashline,variables}.c
- minor changes to prep for making rl_completer_word_break_characters
`const'
subst.[ch],pcomplete.c
- split_at_delims: the DELIMS argument is now `const'; change callers
lib/readline/rlmbutil.h
- _rl_wcwidth: add function prototype for inline function declaration
lib/readline/bind.c
- _rl_get_keyname: print keys greater than 160 (which are valid UTF-8)
as octal escape sequences
lib/readline/text.c
- do_lowercase_version: return 99999 to prevent the linker from
combining it with _rl_null_function and optimizing away the separate
copy. That messes with function pointer comparisons. Part of this
batch of fixes from sparrowhawk996@gmail.com
8/19
----
complete.c,readline.c,readline.h
- rl_completer_word_break_characters: now const char * like
rl_basic_word_break_characters; element of eadline state struct
used to save it also const. THIS IS AN API CHANGE
bashline.c
- orig_rl_completer_word_break_characters: now const char * like
rl_completer_word_break_characters
+4 -3
View File
@@ -374,7 +374,8 @@ enable_hostname_completion (on_or_off)
int on_or_off;
{
int old_value;
char *at, *nv, *nval;
char *nv, *nval;
const char *at;
old_value = perform_hostname_completion;
@@ -434,7 +435,7 @@ enable_hostname_completion (on_or_off)
strcpy (nval + 1, rl_completer_word_break_characters);
}
free (rl_completer_word_break_characters);
free ((void *)rl_completer_word_break_characters);
rl_completer_word_break_characters = nval;
}
@@ -3814,7 +3815,7 @@ bash_complete_filename_internal (what_to_do)
rl_completion_func_t *orig_attempt_func;
rl_icppfunc_t *orig_dir_func;
rl_compignore_func_t *orig_ignore_func;
/*const*/ char *orig_rl_completer_word_break_characters;
const char *orig_rl_completer_word_break_characters;
int r;
orig_func = rl_completion_entry_function;
+9
View File
@@ -2634,6 +2634,15 @@ _rl_get_keyname (int key)
keyname[i++] = (c / 8) + '0';
c = (c % 8) + '0';
}
/* These characters are valid UTF-8; convert them into octal escape
sequences as well. This changes C. */
else if (c >= 160)
{
keyname[i++] = '\\';
keyname[i++] = '0' + ((((unsigned char)c) >> 6) & 0x07);
keyname[i++] = '0' + ((((unsigned char)c) >> 3) & 0x07);
c = (c % 8) + '0';
}
/* Now, if the character needs to be quoted with a backslash, do that. */
if (c == '\\' || c == '"')
+3 -1
View File
@@ -2,7 +2,7 @@
Modified by Chet Ramey for Readline.
Copyright (C) 1985, 1988, 1990-1991, 1995-2010, 2012, 2015, 2017, 2019
Copyright (C) 1985, 1988, 1990-1991, 1995-2021
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -239,8 +239,10 @@ _rl_print_color_indicator (const char *f)
else if (S_ISSOCK (mode))
colored_filetype = C_SOCK;
#endif
#if defined (S_ISBLK)
else if (S_ISBLK (mode))
colored_filetype = C_BLK;
#endif
else if (S_ISCHR (mode))
colored_filetype = C_CHR;
else
+3 -2
View File
@@ -304,7 +304,7 @@ const char *rl_basic_quote_characters = "\"'";
/* The list of characters that signal a break between words for
rl_complete_internal. The default list is the contents of
rl_basic_word_break_characters. */
/*const*/ char *rl_completer_word_break_characters = (/*const*/ char *)NULL;
const char *rl_completer_word_break_characters = 0;
/* Hook function to allow an application to set the completion word
break characters before readline breaks up the line. Allows
@@ -1078,7 +1078,8 @@ char
_rl_find_completion_word (int *fp, int *dp)
{
int scan, end, found_quote, delimiter, pass_next, isbrk;
char quote_char, *brkchars;
char quote_char;
const char *brkchars;
end = rl_point;
found_quote = delimiter = 0;
+2 -2
View File
@@ -1299,8 +1299,8 @@ readline_initialize_everything (void)
/* If the completion parser's default word break characters haven't
been set yet, then do so now. */
if (rl_completer_word_break_characters == (char *)NULL)
rl_completer_word_break_characters = (char *)rl_basic_word_break_characters;
if (rl_completer_word_break_characters == 0)
rl_completer_word_break_characters = rl_basic_word_break_characters;
#if defined (COLOR_SUPPORT)
if (_rl_colored_stats || _rl_colored_completion_prefix)
+2 -2
View File
@@ -700,7 +700,7 @@ extern const char *rl_basic_word_break_characters;
/* The list of characters that signal a break between words for
rl_complete_internal. The default list is the contents of
rl_basic_word_break_characters. */
extern /*const*/ char *rl_completer_word_break_characters;
extern const char *rl_completer_word_break_characters;
/* Hook function to allow an application to set the completion word
break characters before readline breaks up the line. Allows
@@ -961,7 +961,7 @@ struct readline_state {
rl_compentry_func_t *menuentryfunc;
rl_compignore_func_t *ignorefunc;
rl_completion_func_t *attemptfunc;
char *wordbreakchars;
const char *wordbreakchars;
/* options state */
+1 -2
View File
@@ -139,8 +139,7 @@ extern int _rl_walphabetic (WCHAR_T);
/* Try and shortcut the printable ascii characters to cut down the number of
calls to a libc wcwidth() */
static inline int
_rl_wcwidth (wc)
WCHAR_T wc;
_rl_wcwidth (WCHAR_T wc)
{
switch (wc)
{
+1 -1
View File
@@ -1135,7 +1135,7 @@ rl_newline (int count, int key)
int
rl_do_lowercase_version (int ignore1, int ignore2)
{
return 0;
return 99999; /* prevent from being combined with _rl_null_function */
}
/* This is different from what vi does, so the code's not shared. Emacs
+1 -1
View File
@@ -1296,7 +1296,7 @@ command_line_to_word_list (line, llen, sentinel, nwp, cwp)
int llen, sentinel, *nwp, *cwp;
{
WORD_LIST *ret;
char *delims;
const char *delims;
#if 0
delims = "()<>;&| \t\n"; /* shell metacharacters break words */
+2 -2
View File
@@ -2288,7 +2288,7 @@ WORD_LIST *
split_at_delims (string, slen, delims, sentinel, flags, nwp, cwp)
char *string;
int slen;
char *delims;
const char *delims;
int sentinel, flags;
int *nwp, *cwp;
{
@@ -2305,7 +2305,7 @@ split_at_delims (string, slen, delims, sentinel, flags, nwp, cwp)
return ((WORD_LIST *)NULL);
}
d = (delims == 0) ? ifs_value : delims;
d = (delims == 0) ? ifs_value : (char *)delims;
ifs_split = delims == 0;
/* Make d2 the non-whitespace characters in delims */
+1 -1
View File
@@ -326,7 +326,7 @@ extern int skip_to_histexp PARAMS((char *, int, char *, int));
#if defined (READLINE)
extern int char_is_quoted PARAMS((char *, int));
extern int unclosed_pair PARAMS((char *, int, char *));
extern WORD_LIST *split_at_delims PARAMS((char *, int, char *, int, int, int *, int *));
extern WORD_LIST *split_at_delims PARAMS((char *, int, const char *, int, int, int *, int *));
#endif
/* Variables used to keep track of the characters in IFS. */
+1 -1
View File
@@ -1638,7 +1638,7 @@ assign_comp_wordbreaks (self, value, unused, key)
{
if (rl_completer_word_break_characters &&
rl_completer_word_break_characters != rl_basic_word_break_characters)
free (rl_completer_word_break_characters);
free ((void *)rl_completer_word_break_characters);
rl_completer_word_break_characters = savestring (value);
return self;