diff options
author | Chet Ramey <chet.ramey@case.edu> | 2011-12-07 09:14:58 -0500 |
---|---|---|
committer | Chet Ramey <chet.ramey@case.edu> | 2011-12-07 09:14:58 -0500 |
commit | 35bb237e60979c21aa831c83dfb6e873d6ad7b12 (patch) | |
tree | 279868f68ba7923d57c97b0f0460216a474a0543 /lib | |
parent | 97c2aab24ba8e517efa128c0cf345489a22ee2f5 (diff) | |
download | bash-35bb237e60979c21aa831c83dfb6e873d6ad7b12.tar.gz |
commit bash-20071115 snapshot
Diffstat (limited to 'lib')
-rw-r--r-- | lib/readline/mbutil.c | 4 | ||||
-rw-r--r-- | lib/readline/mbutil.c~ | 11 |
2 files changed, 6 insertions, 9 deletions
diff --git a/lib/readline/mbutil.c b/lib/readline/mbutil.c index a0e53d11..a4fe7329 100644 --- a/lib/readline/mbutil.c +++ b/lib/readline/mbutil.c @@ -129,12 +129,10 @@ _rl_find_next_mbchar_internal (string, seed, count, find_non_zero) if (find_non_zero) { tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps); - while (tmp > 0 && wcwidth (wc) == 0) + while (MB_NULLWCH (tmp) == 0 && MB_INVALIDCH (tmp) == 0 && wcwidth (wc) == 0) { point += tmp; tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps); - if (MB_NULLWCH (tmp) || MB_INVALIDCH (tmp)) - break; } } diff --git a/lib/readline/mbutil.c~ b/lib/readline/mbutil.c~ index 17dde53e..6d36d9e5 100644 --- a/lib/readline/mbutil.c~ +++ b/lib/readline/mbutil.c~ @@ -91,8 +91,9 @@ _rl_find_next_mbchar_internal (string, seed, count, find_non_zero) return seed; point = seed + _rl_adjust_point (string, seed, &ps); - /* if this is true, means that seed was not pointed character - started byte. So correct the point and consume count */ + /* if this is true, means that seed was not pointing to a byte indicating + the beginning of a multibyte character. Correct the point and consume + one char. */ if (seed < point) count--; @@ -101,7 +102,7 @@ _rl_find_next_mbchar_internal (string, seed, count, find_non_zero) tmp = mbrtowc (&wc, string+point, strlen(string + point), &ps); if (MB_INVALIDCH ((size_t)tmp)) { - /* invalid bytes. asume a byte represents a character */ + /* invalid bytes. assume a byte represents a character */ point++; count--; /* reset states. */ @@ -128,12 +129,10 @@ _rl_find_next_mbchar_internal (string, seed, count, find_non_zero) if (find_non_zero) { tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps); - while (tmp > 0 && wcwidth (wc) == 0) + while (MB_NULLWCH (tmp) == 0 && MB_INVALIDCH (tmp) == 0 && wc_width (wc) == 0) { point += tmp; tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps); - if (MB_NULLWCH (tmp) || MB_INVALIDCH (tmp)) - break; } } |