top: plug a small potential hole in multi-byte support
Unlike the insp_mkrow_raw function the insp_mkrow_utf8 routine is not equipped to print non-ctl, non-printing characters like '<7f>'. However, technically that very value currently slips through the cracks. So with this patch top will now print a space in the unlikely event a character with the value of 127 is ever encountered. Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
9ea0021070
commit
e189569db2
@ -2700,6 +2700,7 @@ static void insp_mkrow_utf8 (int col, int row) {
|
|||||||
#define mkCTL { if ((to += 2) <= Screen_cols) \
|
#define mkCTL { if ((to += 2) <= Screen_cols) \
|
||||||
PUTT("%s^%c%s", Curwin->capclr_msg, uch + '@', Caps_off); }
|
PUTT("%s^%c%s", Curwin->capclr_msg, uch + '@', Caps_off); }
|
||||||
#endif
|
#endif
|
||||||
|
#define mkNUL { buf1[0] = ' '; doPUT(buf1) }
|
||||||
#define doPUT(buf) if (++to <= Screen_cols) putp(buf);
|
#define doPUT(buf) if (++to <= Screen_cols) putp(buf);
|
||||||
static char buf1[2], buf2[3], buf3[4], buf4[5];
|
static char buf1[2], buf2[3], buf3[4], buf4[5];
|
||||||
char tline[BIGBUFSIZ];
|
char tline[BIGBUFSIZ];
|
||||||
@ -2719,6 +2720,7 @@ static void insp_mkrow_utf8 (int col, int row) {
|
|||||||
case 1:
|
case 1:
|
||||||
if (uch == '\n') break;
|
if (uch == '\n') break;
|
||||||
else if (uch < 32) mkCTL
|
else if (uch < 32) mkCTL
|
||||||
|
else if (uch == 127) mkNUL
|
||||||
else { buf1[0] = uch; doPUT(buf1) }
|
else { buf1[0] = uch; doPUT(buf1) }
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
@ -2734,8 +2736,7 @@ static void insp_mkrow_utf8 (int col, int row) {
|
|||||||
doPUT(buf4)
|
doPUT(buf4)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
buf1[0] = ' ';
|
mkNUL
|
||||||
doPUT(buf1)
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -2749,6 +2750,7 @@ static void insp_mkrow_utf8 (int col, int row) {
|
|||||||
#undef maxSZ
|
#undef maxSZ
|
||||||
#undef mkFND
|
#undef mkFND
|
||||||
#undef mkCTL
|
#undef mkCTL
|
||||||
|
#undef mkNUL
|
||||||
#undef doPUT
|
#undef doPUT
|
||||||
} // end: insp_mkrow_utf8
|
} // end: insp_mkrow_utf8
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user