add minor fixes to make the displaying of invalid multibyte sequences
work again git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2249 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
b54155c4a4
commit
4c6956b433
|
@ -150,7 +150,7 @@ char *control_mbrep(const char *c, char *crep, int *crep_len)
|
||||||
|
|
||||||
if (c_mb_len <= 0) {
|
if (c_mb_len <= 0) {
|
||||||
mbtowc(NULL, NULL, 0);
|
mbtowc(NULL, NULL, 0);
|
||||||
wc = *c;
|
wc = (unsigned char)*c;
|
||||||
}
|
}
|
||||||
|
|
||||||
wcrep = control_wrep(wc);
|
wcrep = control_wrep(wc);
|
||||||
|
@ -237,14 +237,13 @@ char *make_mbchar(unsigned int chr, char *chr_mb, int *chr_mb_len)
|
||||||
*chr_mb_len = wctomb(chr_mb, chr);
|
*chr_mb_len = wctomb(chr_mb, chr);
|
||||||
|
|
||||||
if (*chr_mb_len <= 0) {
|
if (*chr_mb_len <= 0) {
|
||||||
mbtowc(NULL, NULL, 0);
|
wctomb(NULL, 0);
|
||||||
*chr_mb_len = 1;
|
*chr_mb_len = 0;
|
||||||
chr_mb[0] = (unsigned char)chr;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
*chr_mb_len = 1;
|
*chr_mb_len = 1;
|
||||||
chr_mb[0] = (unsigned char)chr;
|
chr_mb[0] = (char)chr;
|
||||||
#ifdef NANO_WIDE
|
#ifdef NANO_WIDE
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2190,7 +2190,7 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool
|
||||||
char *bad_buf_mb = charalloc(mb_cur_max());
|
char *bad_buf_mb = charalloc(mb_cur_max());
|
||||||
int bad_buf_mb_len;
|
int bad_buf_mb_len;
|
||||||
|
|
||||||
bad_buf_mb = make_mbchar((unsigned int)*buf_mb,
|
bad_buf_mb = make_mbchar((unsigned char)*buf_mb,
|
||||||
bad_buf_mb, &bad_buf_mb_len);
|
bad_buf_mb, &bad_buf_mb_len);
|
||||||
|
|
||||||
for (i = 0; i < bad_buf_mb_len; i++)
|
for (i = 0; i < bad_buf_mb_len; i++)
|
||||||
|
|
Loading…
Reference in New Issue