fix to readline redisplay of invisible chars at end of line; fix to here-document delimiter quote removal; prompt expansion makes invisible chars in w, W, s visible

This commit is contained in:
Chet Ramey
2022-03-07 09:21:09 -05:00
parent 6c4a9a5cb7
commit b4e5e5505c
13 changed files with 129 additions and 24 deletions
+8 -5
View File
@@ -52,10 +52,11 @@
#define UNMETA(c) ((c) & 0x7f)
#endif
static int
charvis (s, sindp, ret, rindp)
int
sh_charvis (s, sindp, slen, ret, rindp)
const char *s;
size_t *sindp;
size_t slen;
char *ret;
size_t *rindp;
{
@@ -68,7 +69,7 @@ charvis (s, sindp, ret, rindp)
ri = *rindp;
c = s[*sindp];
send = (locale_mb_cur_max > 1) ? s + strlen (s) : 0;
send = (locale_mb_cur_max > 1) ? s + slen : 0;
if (SAFECHAR (c))
{
@@ -87,7 +88,9 @@ charvis (s, sindp, ret, rindp)
ret[ri++] = UNCTRL (c);
si++;
}
else if (locale_mb_cur_max > 1)
else if (locale_utf8locale && (c & 0x80))
COPY_CHAR_I (ret, ri, s, send, si);
else if (locale_mb_cur_max > 1 && is_basic (c) == 0)
COPY_CHAR_I (ret, ri, s, send, si);
else if (META_CHAR (c))
{
@@ -138,7 +141,7 @@ sh_strvis (string)
sind = 0;
while (string[sind])
sind = charvis (string, &sind, ret, &retind);
sind = sh_charvis (string, &sind, slen, ret, &retind);
ret[retind] = '\0';
return ret;