comparison src/message.c @ 15543:dd725a8ab112 v8.1.0779

patch 8.1.0779: argument for message functions is inconsistent commit https://github.com/vim/vim/commit/32526b3c1846025f0e655f41efd4e5428da16b6c Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jan 19 17:43:09 2019 +0100 patch 8.1.0779: argument for message functions is inconsistent Problem: Argument for message functions is inconsistent. Solution: Make first argument to msg() "char *".
author Bram Moolenaar <Bram@vim.org>
date Sat, 19 Jan 2019 17:45:07 +0100
parents bc17a9d37810
children b069a878bbeb
comparison
equal deleted inserted replaced
15542:5baedae7ca7a 15543:dd725a8ab112
17 #include "vim.h" 17 #include "vim.h"
18 18
19 static void add_msg_hist(char_u *s, int len, int attr); 19 static void add_msg_hist(char_u *s, int len, int attr);
20 static void hit_return_msg(void); 20 static void hit_return_msg(void);
21 static void msg_home_replace_attr(char_u *fname, int attr); 21 static void msg_home_replace_attr(char_u *fname, int attr);
22 static void msg_puts_attr_len(char_u *str, int maxlen, int attr); 22 static void msg_puts_attr_len(char *str, int maxlen, int attr);
23 static void msg_puts_display(char_u *str, int maxlen, int attr, int recurse); 23 static void msg_puts_display(char_u *str, int maxlen, int attr, int recurse);
24 static void msg_scroll_up(void); 24 static void msg_scroll_up(void);
25 static void inc_msg_scrolled(void); 25 static void inc_msg_scrolled(void);
26 static void store_sb_text(char_u **sb_str, char_u *s, int attr, int *sb_col, int finish); 26 static void store_sb_text(char_u **sb_str, char_u *s, int attr, int *sb_col, int finish);
27 static void t_puts(int *t_col, char_u *t_s, char_u *s, int attr); 27 static void t_puts(int *t_col, char_u *t_s, char_u *s, int attr);
94 * msg(s) - displays the string 's' on the status line 94 * msg(s) - displays the string 's' on the status line
95 * When terminal not initialized (yet) mch_errmsg(..) is used. 95 * When terminal not initialized (yet) mch_errmsg(..) is used.
96 * return TRUE if wait_return not called 96 * return TRUE if wait_return not called
97 */ 97 */
98 int 98 int
99 msg(char_u *s) 99 msg(char *s)
100 { 100 {
101 return msg_attr_keep(s, 0, FALSE); 101 return msg_attr_keep(s, 0, FALSE);
102 } 102 }
103 103
104 #if defined(FEAT_EVAL) || defined(FEAT_X11) || defined(USE_XSMP) \ 104 #if defined(FEAT_EVAL) || defined(FEAT_X11) || defined(USE_XSMP) \
105 || defined(FEAT_GUI_GTK) || defined(PROTO) 105 || defined(FEAT_GUI_GTK) || defined(PROTO)
106 /* 106 /*
107 * Like msg() but keep it silent when 'verbosefile' is set. 107 * Like msg() but keep it silent when 'verbosefile' is set.
108 */ 108 */
109 int 109 int
110 verb_msg(char_u *s) 110 verb_msg(char *s)
111 { 111 {
112 int n; 112 int n;
113 113
114 verbose_enter(); 114 verbose_enter();
115 n = msg_attr_keep(s, 0, FALSE); 115 n = msg_attr_keep(s, 0, FALSE);
118 return n; 118 return n;
119 } 119 }
120 #endif 120 #endif
121 121
122 int 122 int
123 msg_attr(char_u *s, int attr) 123 msg_attr(char *s, int attr)
124 { 124 {
125 return msg_attr_keep(s, attr, FALSE); 125 return msg_attr_keep(s, attr, FALSE);
126 } 126 }
127 127
128 int 128 int
129 msg_attr_keep( 129 msg_attr_keep(
130 char_u *s, 130 char *s,
131 int attr, 131 int attr,
132 int keep) /* TRUE: set keep_msg if it doesn't scroll */ 132 int keep) /* TRUE: set keep_msg if it doesn't scroll */
133 { 133 {
134 static int entered = 0; 134 static int entered = 0;
135 int retval; 135 int retval;
136 char_u *buf = NULL; 136 char_u *buf = NULL;
137 137
138 /* Skip messages not matching ":filter pattern". 138 /* Skip messages not matching ":filter pattern".
139 * Don't filter when there is an error. */ 139 * Don't filter when there is an error. */
140 if (!emsg_on_display && message_filtered(s)) 140 if (!emsg_on_display && message_filtered((char_u *)s))
141 return TRUE; 141 return TRUE;
142 142
143 #ifdef FEAT_EVAL 143 #ifdef FEAT_EVAL
144 if (attr == 0) 144 if (attr == 0)
145 set_vim_var_string(VV_STATUSMSG, s, -1); 145 set_vim_var_string(VV_STATUSMSG, (char_u *)s, -1);
146 #endif 146 #endif
147 147
148 /* 148 /*
149 * It is possible that displaying a messages causes a problem (e.g., 149 * It is possible that displaying a messages causes a problem (e.g.,
150 * when redrawing the window), which causes another message, etc.. To 150 * when redrawing the window), which causes another message, etc.. To
154 return TRUE; 154 return TRUE;
155 ++entered; 155 ++entered;
156 156
157 /* Add message to history (unless it's a repeated kept message or a 157 /* Add message to history (unless it's a repeated kept message or a
158 * truncated message) */ 158 * truncated message) */
159 if (s != keep_msg 159 if ((char_u *)s != keep_msg
160 || (*s != '<' 160 || (*s != '<'
161 && last_msg_hist != NULL 161 && last_msg_hist != NULL
162 && last_msg_hist->msg != NULL 162 && last_msg_hist->msg != NULL
163 && STRCMP(s, last_msg_hist->msg))) 163 && STRCMP(s, last_msg_hist->msg)))
164 add_msg_hist(s, -1, attr); 164 add_msg_hist((char_u *)s, -1, attr);
165 165
166 #ifdef FEAT_JOB_CHANNEL 166 #ifdef FEAT_JOB_CHANNEL
167 if (emsg_to_channel_log) 167 if (emsg_to_channel_log)
168 /* Write message in the channel log. */ 168 /* Write message in the channel log. */
169 ch_log(NULL, "ERROR: %s", (char *)s); 169 ch_log(NULL, "ERROR: %s", (char *)s);
170 #endif 170 #endif
171 171
172 /* When displaying keep_msg, don't let msg_start() free it, caller must do 172 /* When displaying keep_msg, don't let msg_start() free it, caller must do
173 * that. */ 173 * that. */
174 if (s == keep_msg) 174 if ((char_u *)s == keep_msg)
175 keep_msg = NULL; 175 keep_msg = NULL;
176 176
177 /* Truncate the message if needed. */ 177 /* Truncate the message if needed. */
178 msg_start(); 178 msg_start();
179 buf = msg_strtrunc(s, FALSE); 179 buf = msg_strtrunc((char_u *)s, FALSE);
180 if (buf != NULL) 180 if (buf != NULL)
181 s = buf; 181 s = (char *)buf;
182 182
183 msg_outtrans_attr(s, attr); 183 msg_outtrans_attr((char_u *)s, attr);
184 msg_clr_eos(); 184 msg_clr_eos();
185 retval = msg_end(); 185 retval = msg_end();
186 186
187 if (keep && retval && vim_strsize(s) < (int)(Rows - cmdline_row - 1) 187 if (keep && retval && vim_strsize((char_u *)s)
188 * Columns + sc_col) 188 < (int)(Rows - cmdline_row - 1) * Columns + sc_col)
189 set_keep_msg(s, 0); 189 set_keep_msg((char_u *)s, 0);
190 190
191 vim_free(buf); 191 vim_free(buf);
192 --entered; 192 --entered;
193 return retval; 193 return retval;
194 } 194 }
374 va_list arglist; 374 va_list arglist;
375 375
376 va_start(arglist, s); 376 va_start(arglist, s);
377 vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist); 377 vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist);
378 va_end(arglist); 378 va_end(arglist);
379 return msg(IObuff); 379 return msg((char *)IObuff);
380 } 380 }
381 381
382 int 382 int
383 # ifdef __BORLANDC__ 383 # ifdef __BORLANDC__
384 _RTLENTRYF 384 _RTLENTRYF
388 va_list arglist; 388 va_list arglist;
389 389
390 va_start(arglist, s); 390 va_start(arglist, s);
391 vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist); 391 vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist);
392 va_end(arglist); 392 va_end(arglist);
393 return msg_attr(IObuff, attr); 393 return msg_attr((char *)IObuff, attr);
394 } 394 }
395 395
396 int 396 int
397 # ifdef __BORLANDC__ 397 # ifdef __BORLANDC__
398 _RTLENTRYF 398 _RTLENTRYF
402 va_list arglist; 402 va_list arglist;
403 403
404 va_start(arglist, s); 404 va_start(arglist, s);
405 vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist); 405 vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist);
406 va_end(arglist); 406 va_end(arglist);
407 return msg_attr_keep(IObuff, attr, TRUE); 407 return msg_attr_keep((char *)IObuff, attr, TRUE);
408 } 408 }
409 409
410 #endif 410 #endif
411 411
412 /* 412 /*
500 500
501 ++no_wait_return; 501 ++no_wait_return;
502 p = get_emsg_source(); 502 p = get_emsg_source();
503 if (p != NULL) 503 if (p != NULL)
504 { 504 {
505 msg_attr(p, attr); 505 msg_attr((char *)p, attr);
506 vim_free(p); 506 vim_free(p);
507 } 507 }
508 p = get_emsg_lnum(); 508 p = get_emsg_lnum();
509 if (p != NULL) 509 if (p != NULL)
510 { 510 {
511 msg_attr(p, HL_ATTR(HLF_N)); 511 msg_attr((char *)p, HL_ATTR(HLF_N));
512 vim_free(p); 512 vim_free(p);
513 last_sourcing_lnum = sourcing_lnum; /* only once for each line */ 513 last_sourcing_lnum = sourcing_lnum; /* only once for each line */
514 } 514 }
515 515
516 /* remember the last sourcing name printed, also when it's empty */ 516 /* remember the last sourcing name printed, also when it's empty */
609 609
610 #ifdef FEAT_EVAL 610 #ifdef FEAT_EVAL
611 /* When testing some errors are turned into a normal message. */ 611 /* When testing some errors are turned into a normal message. */
612 if (ignore_error(s)) 612 if (ignore_error(s))
613 /* don't call msg() if it results in a dialog */ 613 /* don't call msg() if it results in a dialog */
614 return msg_use_printf() ? FALSE : msg(s); 614 return msg_use_printf() ? FALSE : msg((char *)s);
615 #endif 615 #endif
616 616
617 called_emsg = TRUE; 617 called_emsg = TRUE;
618 618
619 #ifdef FEAT_EVAL 619 #ifdef FEAT_EVAL
714 714
715 /* 715 /*
716 * Display the error message itself. 716 * Display the error message itself.
717 */ 717 */
718 msg_nowait = FALSE; /* wait for this msg */ 718 msg_nowait = FALSE; /* wait for this msg */
719 r = msg_attr(s, attr); 719 r = msg_attr((char *)s, attr);
720 720
721 #ifdef FEAT_JOB_CHANNEL 721 #ifdef FEAT_JOB_CHANNEL
722 emsg_to_channel_log = FALSE; 722 emsg_to_channel_log = FALSE;
723 #endif 723 #endif
724 return r; 724 return r;
815 * Like msg(), but truncate to a single line if p_shm contains 't', or when 815 * Like msg(), but truncate to a single line if p_shm contains 't', or when
816 * "force" is TRUE. This truncates in another way as for normal messages. 816 * "force" is TRUE. This truncates in another way as for normal messages.
817 * Careful: The string may be changed by msg_may_trunc()! 817 * Careful: The string may be changed by msg_may_trunc()!
818 * Returns a pointer to the printed message, if wait_return() not called. 818 * Returns a pointer to the printed message, if wait_return() not called.
819 */ 819 */
820 char_u * 820 char *
821 msg_trunc_attr(char_u *s, int force, int attr) 821 msg_trunc_attr(char *s, int force, int attr)
822 { 822 {
823 int n; 823 int n;
824 char *ts;
824 825
825 /* Add message to history before truncating */ 826 /* Add message to history before truncating */
826 add_msg_hist(s, -1, attr); 827 add_msg_hist((char_u *)s, -1, attr);
827 828
828 s = msg_may_trunc(force, s); 829 ts = (char *)msg_may_trunc(force, (char_u *)s);
829 830
830 msg_hist_off = TRUE; 831 msg_hist_off = TRUE;
831 n = msg_attr(s, attr); 832 n = msg_attr(ts, attr);
832 msg_hist_off = FALSE; 833 msg_hist_off = FALSE;
833 834
834 if (n) 835 if (n)
835 return s; 836 return ts;
836 return NULL; 837 return NULL;
837 } 838 }
838 839
839 /* 840 /*
840 * Check if message "s" should be truncated at the start (for filenames). 841 * Check if message "s" should be truncated at the start (for filenames).
981 { 982 {
982 s = mch_getenv((char_u *)"LANG"); 983 s = mch_getenv((char_u *)"LANG");
983 if (s != NULL && *s != NUL) 984 if (s != NULL && *s != NUL)
984 // The next comment is extracted by xgettext and put in po file for 985 // The next comment is extracted by xgettext and put in po file for
985 // translators to read. 986 // translators to read.
986 msg_attr((char_u *) 987 msg_attr(
987 // Translator: Please replace the name and email address 988 // Translator: Please replace the name and email address
988 // with the appropriate text for your translation. 989 // with the appropriate text for your translation.
989 _("Messages maintainer: Bram Moolenaar <Bram@vim.org>"), 990 _("Messages maintainer: Bram Moolenaar <Bram@vim.org>"),
990 HL_ATTR(HLF_T)); 991 HL_ATTR(HLF_T));
991 } 992 }
992 993
993 /* Display what was not skipped. */ 994 /* Display what was not skipped. */
994 for (; p != NULL && !got_int; p = p->next) 995 for (; p != NULL && !got_int; p = p->next)
995 if (p->msg != NULL) 996 if (p->msg != NULL)
996 msg_attr(p->msg, p->attr); 997 msg_attr((char *)p->msg, p->attr);
997 998
998 msg_hist_off = FALSE; 999 msg_hist_off = FALSE;
999 } 1000 }
1000 1001
1001 #if defined(FEAT_CON_DIALOG) || defined(FIND_REPLACE_DIALOG) || defined(PROTO) 1002 #if defined(FEAT_CON_DIALOG) || defined(FIND_REPLACE_DIALOG) || defined(PROTO)
1014 lines_left = -1; 1015 lines_left = -1;
1015 } 1016 }
1016 #endif 1017 #endif
1017 1018
1018 /* 1019 /*
1019 * wait for the user to hit a key (normally a return) 1020 * Wait for the user to hit a key (normally Enter).
1020 * if 'redraw' is TRUE, clear and redraw the screen 1021 * If "redraw" is TRUE, clear and redraw the screen.
1021 * if 'redraw' is FALSE, just redraw the screen 1022 * If "redraw" is FALSE, just redraw the screen.
1022 * if 'redraw' is -1, don't redraw at all 1023 * If "redraw" is -1, don't redraw at all.
1023 */ 1024 */
1024 void 1025 void
1025 wait_return(int redraw) 1026 wait_return(int redraw)
1026 { 1027 {
1027 int c; 1028 int c;
1063 quit_more = FALSE; 1064 quit_more = FALSE;
1064 got_int = FALSE; 1065 got_int = FALSE;
1065 } 1066 }
1066 else if (exmode_active) 1067 else if (exmode_active)
1067 { 1068 {
1068 MSG_PUTS(" "); /* make sure the cursor is on the right line */ 1069 msg_puts(" "); /* make sure the cursor is on the right line */
1069 c = CAR; /* no need for a return in ex mode */ 1070 c = CAR; /* no need for a return in ex mode */
1070 got_int = FALSE; 1071 got_int = FALSE;
1071 } 1072 }
1072 else 1073 else
1073 { 1074 {
1279 1280
1280 p_more = FALSE; /* don't want see this message when scrolling back */ 1281 p_more = FALSE; /* don't want see this message when scrolling back */
1281 if (msg_didout) /* start on a new line */ 1282 if (msg_didout) /* start on a new line */
1282 msg_putchar('\n'); 1283 msg_putchar('\n');
1283 if (got_int) 1284 if (got_int)
1284 MSG_PUTS(_("Interrupt: ")); 1285 msg_puts(_("Interrupt: "));
1285 1286
1286 MSG_PUTS_ATTR(_("Press ENTER or type command to continue"), HL_ATTR(HLF_R)); 1287 msg_puts_attr(_("Press ENTER or type command to continue"), HL_ATTR(HLF_R));
1287 if (!msg_use_printf()) 1288 if (!msg_use_printf())
1288 msg_clr_eos(); 1289 msg_clr_eos();
1289 p_more = save_p_more; 1290 p_more = save_p_more;
1290 } 1291 }
1291 1292
1386 1387
1387 void 1388 void
1388 msg_putchar_attr(int c, int attr) 1389 msg_putchar_attr(int c, int attr)
1389 { 1390 {
1390 #ifdef FEAT_MBYTE 1391 #ifdef FEAT_MBYTE
1391 char_u buf[MB_MAXBYTES + 1]; 1392 char buf[MB_MAXBYTES + 1];
1392 #else 1393 #else
1393 char_u buf[4]; 1394 char buf[4];
1394 #endif 1395 #endif
1395 1396
1396 if (IS_SPECIAL(c)) 1397 if (IS_SPECIAL(c))
1397 { 1398 {
1398 buf[0] = K_SPECIAL; 1399 buf[0] = K_SPECIAL;
1401 buf[3] = NUL; 1402 buf[3] = NUL;
1402 } 1403 }
1403 else 1404 else
1404 { 1405 {
1405 #ifdef FEAT_MBYTE 1406 #ifdef FEAT_MBYTE
1406 buf[(*mb_char2bytes)(c, buf)] = NUL; 1407 buf[(*mb_char2bytes)(c, (char_u *)buf)] = NUL;
1407 #else 1408 #else
1408 buf[0] = c; 1409 buf[0] = c;
1409 buf[1] = NUL; 1410 buf[1] = NUL;
1410 #endif 1411 #endif
1411 } 1412 }
1413 } 1414 }
1414 1415
1415 void 1416 void
1416 msg_outnum(long n) 1417 msg_outnum(long n)
1417 { 1418 {
1418 char_u buf[20]; 1419 char buf[20];
1419 1420
1420 sprintf((char *)buf, "%ld", n); 1421 sprintf(buf, "%ld", n);
1421 msg_puts(buf); 1422 msg_puts(buf);
1422 } 1423 }
1423 1424
1424 void 1425 void
1425 msg_home_replace(char_u *fname) 1426 msg_home_replace(char_u *fname)
1484 { 1485 {
1485 msg_outtrans_len_attr(p, l, attr); 1486 msg_outtrans_len_attr(p, l, attr);
1486 return p + l; 1487 return p + l;
1487 } 1488 }
1488 #endif 1489 #endif
1489 msg_puts_attr(transchar_byte(*p), attr); 1490 msg_puts_attr((char *)transchar_byte(*p), attr);
1490 return p + 1; 1491 return p + 1;
1491 } 1492 }
1492 1493
1493 int 1494 int
1494 msg_outtrans_len_attr(char_u *msgstr, int len, int attr) 1495 msg_outtrans_len_attr(char_u *msgstr, int len, int attr)
1511 1512
1512 #ifdef FEAT_MBYTE 1513 #ifdef FEAT_MBYTE
1513 /* If the string starts with a composing character first draw a space on 1514 /* If the string starts with a composing character first draw a space on
1514 * which the composing char can be drawn. */ 1515 * which the composing char can be drawn. */
1515 if (enc_utf8 && utf_iscomposing(utf_ptr2char(msgstr))) 1516 if (enc_utf8 && utf_iscomposing(utf_ptr2char(msgstr)))
1516 msg_puts_attr((char_u *)" ", attr); 1517 msg_puts_attr(" ", attr);
1517 #endif 1518 #endif
1518 1519
1519 /* 1520 /*
1520 * Go over the string. Special characters are translated and printed. 1521 * Go over the string. Special characters are translated and printed.
1521 * Normal characters are printed several at a time. 1522 * Normal characters are printed several at a time.
1539 else 1540 else
1540 { 1541 {
1541 /* unprintable multi-byte char: print the printable chars so 1542 /* unprintable multi-byte char: print the printable chars so
1542 * far and the translation of the unprintable char. */ 1543 * far and the translation of the unprintable char. */
1543 if (str > plain_start) 1544 if (str > plain_start)
1544 msg_puts_attr_len(plain_start, (int)(str - plain_start), 1545 msg_puts_attr_len((char *)plain_start,
1545 attr); 1546 (int)(str - plain_start), attr);
1546 plain_start = str + mb_l; 1547 plain_start = str + mb_l;
1547 msg_puts_attr(transchar(c), attr == 0 ? HL_ATTR(HLF_8) : attr); 1548 msg_puts_attr((char *)transchar(c),
1549 attr == 0 ? HL_ATTR(HLF_8) : attr);
1548 retval += char2cells(c); 1550 retval += char2cells(c);
1549 } 1551 }
1550 len -= mb_l - 1; 1552 len -= mb_l - 1;
1551 str += mb_l; 1553 str += mb_l;
1552 } 1554 }
1557 if (s[1] != NUL) 1559 if (s[1] != NUL)
1558 { 1560 {
1559 /* unprintable char: print the printable chars so far and the 1561 /* unprintable char: print the printable chars so far and the
1560 * translation of the unprintable char. */ 1562 * translation of the unprintable char. */
1561 if (str > plain_start) 1563 if (str > plain_start)
1562 msg_puts_attr_len(plain_start, (int)(str - plain_start), 1564 msg_puts_attr_len((char *)plain_start,
1563 attr); 1565 (int)(str - plain_start), attr);
1564 plain_start = str + 1; 1566 plain_start = str + 1;
1565 msg_puts_attr(s, attr == 0 ? HL_ATTR(HLF_8) : attr); 1567 msg_puts_attr((char *)s, attr == 0 ? HL_ATTR(HLF_8) : attr);
1566 retval += (int)STRLEN(s); 1568 retval += (int)STRLEN(s);
1567 } 1569 }
1568 else 1570 else
1569 ++retval; 1571 ++retval;
1570 ++str; 1572 ++str;
1571 } 1573 }
1572 } 1574 }
1573 1575
1574 if (str > plain_start) 1576 if (str > plain_start)
1575 /* print the printable chars at the end */ 1577 /* print the printable chars at the end */
1576 msg_puts_attr_len(plain_start, (int)(str - plain_start), attr); 1578 msg_puts_attr_len((char *)plain_start, (int)(str - plain_start), attr);
1577 1579
1578 return retval; 1580 return retval;
1579 } 1581 }
1580 1582
1581 #if defined(FEAT_QUICKFIX) || defined(PROTO) 1583 #if defined(FEAT_QUICKFIX) || defined(PROTO)
1617 char_u *strstart, 1619 char_u *strstart,
1618 int from) /* TRUE for lhs of a mapping */ 1620 int from) /* TRUE for lhs of a mapping */
1619 { 1621 {
1620 char_u *str = strstart; 1622 char_u *str = strstart;
1621 int retval = 0; 1623 int retval = 0;
1622 char_u *string; 1624 char *text;
1623 int attr; 1625 int attr;
1624 int len; 1626 int len;
1625 1627
1626 attr = HL_ATTR(HLF_8); 1628 attr = HL_ATTR(HLF_8);
1627 while (*str != NUL) 1629 while (*str != NUL)
1628 { 1630 {
1629 /* Leading and trailing spaces need to be displayed in <> form. */ 1631 /* Leading and trailing spaces need to be displayed in <> form. */
1630 if ((str == strstart || str[1] == NUL) && *str == ' ') 1632 if ((str == strstart || str[1] == NUL) && *str == ' ')
1631 { 1633 {
1632 string = (char_u *)"<Space>"; 1634 text = "<Space>";
1633 ++str; 1635 ++str;
1634 } 1636 }
1635 else 1637 else
1636 string = str2special(&str, from); 1638 text = (char *)str2special(&str, from);
1637 len = vim_strsize(string); 1639 len = vim_strsize((char_u *)text);
1638 /* Highlight special keys */ 1640 /* Highlight special keys */
1639 msg_puts_attr(string, len > 1 1641 msg_puts_attr(text, len > 1
1640 #ifdef FEAT_MBYTE 1642 #ifdef FEAT_MBYTE
1641 && (*mb_ptr2len)(string) <= 1 1643 && (*mb_ptr2len)((char_u *)text) <= 1
1642 #endif 1644 #endif
1643 ? attr : 0); 1645 ? attr : 0);
1644 retval += len; 1646 retval += len;
1645 } 1647 }
1646 return retval; 1648 return retval;
1823 else 1825 else
1824 { 1826 {
1825 mch_memmove(buf, s, (size_t)l); 1827 mch_memmove(buf, s, (size_t)l);
1826 buf[l] = NUL; 1828 buf[l] = NUL;
1827 } 1829 }
1828 msg_puts(buf); 1830 msg_puts((char *)buf);
1829 s += l; 1831 s += l;
1830 continue; 1832 continue;
1831 } 1833 }
1832 #endif 1834 #endif
1833 else 1835 else
1955 /* 1957 /*
1956 * Output a string to the screen at position msg_row, msg_col. 1958 * Output a string to the screen at position msg_row, msg_col.
1957 * Update msg_row and msg_col for the next message. 1959 * Update msg_row and msg_col for the next message.
1958 */ 1960 */
1959 void 1961 void
1960 msg_puts(char_u *s) 1962 msg_puts(char *s)
1961 { 1963 {
1962 msg_puts_attr(s, 0); 1964 msg_puts_attr(s, 0);
1963 } 1965 }
1964 1966
1965 void 1967 void
1966 msg_puts_title( 1968 msg_puts_title(char *s)
1967 char_u *s)
1968 { 1969 {
1969 msg_puts_attr(s, HL_ATTR(HLF_T)); 1970 msg_puts_attr(s, HL_ATTR(HLF_T));
1970 } 1971 }
1971 1972
1972 /* 1973 /*
1973 * Show a message in such a way that it always fits in the line. Cut out a 1974 * Show a message in such a way that it always fits in the line. Cut out a
1974 * part in the middle and replace it with "..." when necessary. 1975 * part in the middle and replace it with "..." when necessary.
1975 * Does not handle multi-byte characters! 1976 * Does not handle multi-byte characters!
1976 */ 1977 */
1977 void 1978 void
1978 msg_puts_long_attr(char_u *longstr, int attr) 1979 msg_outtrans_long_attr(char_u *longstr, int attr)
1979 { 1980 {
1980 msg_puts_long_len_attr(longstr, (int)STRLEN(longstr), attr); 1981 msg_outtrans_long_len_attr(longstr, (int)STRLEN(longstr), attr);
1981 } 1982 }
1982 1983
1983 void 1984 void
1984 msg_puts_long_len_attr(char_u *longstr, int len, int attr) 1985 msg_outtrans_long_len_attr(char_u *longstr, int len, int attr)
1985 { 1986 {
1986 int slen = len; 1987 int slen = len;
1987 int room; 1988 int room;
1988 1989
1989 room = Columns - msg_col; 1990 room = Columns - msg_col;
1990 if (len > room && room >= 20) 1991 if (len > room && room >= 20)
1991 { 1992 {
1992 slen = (room - 3) / 2; 1993 slen = (room - 3) / 2;
1993 msg_outtrans_len_attr(longstr, slen, attr); 1994 msg_outtrans_len_attr(longstr, slen, attr);
1994 msg_puts_attr((char_u *)"...", HL_ATTR(HLF_8)); 1995 msg_puts_attr("...", HL_ATTR(HLF_8));
1995 } 1996 }
1996 msg_outtrans_len_attr(longstr + len - slen, slen, attr); 1997 msg_outtrans_len_attr(longstr + len - slen, slen, attr);
1997 } 1998 }
1998 1999
1999 /* 2000 /*
2000 * Basic function for writing a message with highlight attributes. 2001 * Basic function for writing a message with highlight attributes.
2001 */ 2002 */
2002 void 2003 void
2003 msg_puts_attr(char_u *s, int attr) 2004 msg_puts_attr(char *s, int attr)
2004 { 2005 {
2005 msg_puts_attr_len(s, -1, attr); 2006 msg_puts_attr_len(s, -1, attr);
2006 } 2007 }
2007 2008
2008 /* 2009 /*
2009 * Like msg_puts_attr(), but with a maximum length "maxlen" (in bytes). 2010 * Like msg_puts_attr(), but with a maximum length "maxlen" (in bytes).
2010 * When "maxlen" is -1 there is no maximum length. 2011 * When "maxlen" is -1 there is no maximum length.
2011 * When "maxlen" is >= 0 the message is not put in the history. 2012 * When "maxlen" is >= 0 the message is not put in the history.
2012 */ 2013 */
2013 static void 2014 static void
2014 msg_puts_attr_len(char_u *str, int maxlen, int attr) 2015 msg_puts_attr_len(char *str, int maxlen, int attr)
2015 { 2016 {
2016 /* 2017 /*
2017 * If redirection is on, also write to the redirection file. 2018 * If redirection is on, also write to the redirection file.
2018 */ 2019 */
2019 redir_write(str, maxlen); 2020 redir_write((char_u *)str, maxlen);
2020 2021
2021 /* 2022 /*
2022 * Don't print anything when using ":silent cmd". 2023 * Don't print anything when using ":silent cmd".
2023 */ 2024 */
2024 if (msg_silent != 0) 2025 if (msg_silent != 0)
2025 return; 2026 return;
2026 2027
2027 /* if MSG_HIST flag set, add message to history */ 2028 /* if MSG_HIST flag set, add message to history */
2028 if ((attr & MSG_HIST) && maxlen < 0) 2029 if ((attr & MSG_HIST) && maxlen < 0)
2029 { 2030 {
2030 add_msg_hist(str, -1, attr); 2031 add_msg_hist((char_u *)str, -1, attr);
2031 attr &= ~MSG_HIST; 2032 attr &= ~MSG_HIST;
2032 } 2033 }
2033 2034
2034 /* 2035 /*
2035 * When writing something to the screen after it has scrolled, requires a 2036 * When writing something to the screen after it has scrolled, requires a
2047 * window, cursor positioning may not work correctly (window size may be 2048 * window, cursor positioning may not work correctly (window size may be
2048 * different, e.g. for Win32 console) or we just don't know where the 2049 * different, e.g. for Win32 console) or we just don't know where the
2049 * cursor is. 2050 * cursor is.
2050 */ 2051 */
2051 if (msg_use_printf()) 2052 if (msg_use_printf())
2052 msg_puts_printf(str, maxlen); 2053 msg_puts_printf((char_u *)str, maxlen);
2053 else 2054 else
2054 msg_puts_display(str, maxlen, attr, FALSE); 2055 msg_puts_display((char_u *)str, maxlen, attr, FALSE);
2055 } 2056 }
2056 2057
2057 /* 2058 /*
2058 * The display part of msg_puts_attr_len(). 2059 * The display part of msg_puts_attr_len().
2059 * May be called recursively to display scroll-back text. 2060 * May be called recursively to display scroll-back text.
3495 VIM_CLEAR(keep_msg); 3496 VIM_CLEAR(keep_msg);
3496 if (hl) 3497 if (hl)
3497 keep_msg_attr = HL_ATTR(HLF_W); 3498 keep_msg_attr = HL_ATTR(HLF_W);
3498 else 3499 else
3499 keep_msg_attr = 0; 3500 keep_msg_attr = 0;
3500 if (msg_attr(message, keep_msg_attr) && msg_scrolled == 0) 3501 if (msg_attr((char *)message, keep_msg_attr) && msg_scrolled == 0)
3501 set_keep_msg(message, keep_msg_attr); 3502 set_keep_msg(message, keep_msg_attr);
3502 msg_didout = FALSE; /* overwrite this message */ 3503 msg_didout = FALSE; /* overwrite this message */
3503 msg_nowait = TRUE; /* don't wait for this message */ 3504 msg_nowait = TRUE; /* don't wait for this message */
3504 msg_col = 0; 3505 msg_col = 0;
3505 3506
3889 display_confirm_msg(void) 3890 display_confirm_msg(void)
3890 { 3891 {
3891 /* avoid that 'q' at the more prompt truncates the message here */ 3892 /* avoid that 'q' at the more prompt truncates the message here */
3892 ++confirm_msg_used; 3893 ++confirm_msg_used;
3893 if (confirm_msg != NULL) 3894 if (confirm_msg != NULL)
3894 msg_puts_attr(confirm_msg, HL_ATTR(HLF_M)); 3895 msg_puts_attr((char *)confirm_msg, HL_ATTR(HLF_M));
3895 --confirm_msg_used; 3896 --confirm_msg_used;
3896 } 3897 }
3897 3898
3898 #endif /* FEAT_CON_DIALOG */ 3899 #endif /* FEAT_CON_DIALOG */
3899 3900