changes for multibyte characters with intermediate state; small change to readline forced redisplay

This commit is contained in:
Chet Ramey
2022-09-28 11:00:34 -04:00
parent bdfa4b088e
commit e6dc31ac13
11 changed files with 90 additions and 38 deletions
+4 -6
View File
@@ -684,7 +684,7 @@ init_line_structures (int minsize)
if (line_size > minsize)
minsize = line_size;
}
realloc_line (minsize);
realloc_line (minsize);
if (vis_lbreaks == 0)
{
@@ -2681,13 +2681,11 @@ int
rl_forced_update_display (void)
{
register char *temp;
register int tlen;
if (visible_line)
{
temp = visible_line;
while (*temp)
*temp++ = '\0';
}
memset (visible_line, 0, line_size);
rl_on_new_line ();
forced_display++;
(*rl_redisplay_function) ();
+5 -6
View File
@@ -1,6 +1,6 @@
/* mbscasecmp - case-insensitive multibyte string comparison. */
/* Copyright (C) 2009-2015 Free Software Foundation, Inc.
/* Copyright (C) 2009-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -37,16 +37,15 @@ mbscasecmp (mbs1, mbs2)
{
int len1, len2, mb_cur_max;
wchar_t c1, c2, l1, l2;
mbstate_t state1 = { 0 }, state2 = { 0 };
len1 = len2 = 0;
/* Reset multibyte characters to their initial state. */
(void) mblen ((char *) NULL, 0);
mb_cur_max = MB_CUR_MAX;
do
{
len1 = mbtowc (&c1, mbs1, mb_cur_max);
len2 = mbtowc (&c2, mbs2, mb_cur_max);
len1 = mbrtowc (&c1, mbs1, mb_cur_max, &state1);
len2 = mbrtowc (&c2, mbs2, mb_cur_max, &state2);
if (len1 == 0)
return len2 == 0 ? 0 : -1;
+5 -6
View File
@@ -1,6 +1,6 @@
/* mbscmp - multibyte string comparison. */
/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
/* Copyright (C) 1995-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -38,16 +38,15 @@ mbscmp (mbs1, mbs2)
{
int len1, len2, mb_cur_max;
wchar_t c1, c2;
mbstate_t state1 = { 0 }, state2 = { 0 };
len1 = len2 = 0;
/* Reset multibyte characters to their initial state. */
(void) mblen ((char *) NULL, 0);
mb_cur_max = MB_CUR_MAX;
do
{
len1 = mbtowc (&c1, mbs1, mb_cur_max);
len2 = mbtowc (&c2, mbs2, mb_cur_max);
len1 = mbrtowc (&c1, mbs1, mb_cur_max, &state1);
len2 = mbrtowc (&c2, mbs2, mb_cur_max, &state2);
if (len1 == 0)
return len2 == 0 ? 0 : -1;