aboutsummaryrefslogtreecommitdiff
path: root/editors/vi.c
diff options
context:
space:
mode:
Diffstat (limited to 'editors/vi.c')
-rw-r--r--editors/vi.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/editors/vi.c b/editors/vi.c
index eee5e0ed2..e4ba2b2b0 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -1377,21 +1377,14 @@ static void print_literal(char *buf, const char *s)
1377 char *d; 1377 char *d;
1378 unsigned char c; 1378 unsigned char c;
1379 1379
1380 buf[0] = '\0';
1381 if (!s[0]) 1380 if (!s[0])
1382 s = "(NULL)"; 1381 s = "(NULL)";
1383 1382
1384 d = buf; 1383 d = buf;
1385 for (; *s; s++) { 1384 for (; *s; s++) {
1386 int c_is_no_print;
1387
1388 c = *s; 1385 c = *s;
1389 c_is_no_print = (c & 0x80) && !Isprint(c); 1386 if ((c & 0x80) && !Isprint(c))
1390 if (c_is_no_print) { 1387 c = '?';
1391 strcpy(d, ESC_NORM_TEXT);
1392 d += sizeof(ESC_NORM_TEXT)-1;
1393 c = '.';
1394 }
1395 if (c < ' ' || c == 0x7f) { 1388 if (c < ' ' || c == 0x7f) {
1396 *d++ = '^'; 1389 *d++ = '^';
1397 c |= '@'; // 0x40 1390 c |= '@'; // 0x40
@@ -1400,14 +1393,6 @@ static void print_literal(char *buf, const char *s)
1400 } 1393 }
1401 *d++ = c; 1394 *d++ = c;
1402 *d = '\0'; 1395 *d = '\0';
1403 if (c_is_no_print) {
1404 strcpy(d, ESC_BOLD_TEXT);
1405 d += sizeof(ESC_BOLD_TEXT)-1;
1406 }
1407 if (*s == '\n') {
1408 *d++ = '$';
1409 *d = '\0';
1410 }
1411 if (d - buf > MAX_INPUT_LEN - 10) // paranoia 1396 if (d - buf > MAX_INPUT_LEN - 10) // paranoia
1412 break; 1397 break;
1413 } 1398 }