Mercurial > vim
comparison src/message.c @ 11158:501f46f7644c v8.0.0466
patch 8.0.0466: still macros that should be all-caps
commit https://github.com/vim/vim/commit/8820b48654b62472821d9b155fe03ab7ac13a05c
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Mar 16 17:23:31 2017 +0100
patch 8.0.0466: still macros that should be all-caps
Problem: There are still a few macros that should be all-caps.
Solution: Make a few more macros all-caps.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 16 Mar 2017 17:30:06 +0100 |
parents | f4ea50924c6d |
children | f4d1fad4ac00 |
comparison
equal
deleted
inserted
replaced
11157:35a1705f4d02 | 11158:501f46f7644c |
---|---|
501 vim_free(p); | 501 vim_free(p); |
502 } | 502 } |
503 p = get_emsg_lnum(); | 503 p = get_emsg_lnum(); |
504 if (p != NULL) | 504 if (p != NULL) |
505 { | 505 { |
506 msg_attr(p, hl_attr(HLF_N)); | 506 msg_attr(p, HL_ATTR(HLF_N)); |
507 vim_free(p); | 507 vim_free(p); |
508 last_sourcing_lnum = sourcing_lnum; /* only once for each line */ | 508 last_sourcing_lnum = sourcing_lnum; /* only once for each line */ |
509 } | 509 } |
510 | 510 |
511 /* remember the last sourcing name printed, also when it's empty */ | 511 /* remember the last sourcing name printed, also when it's empty */ |
688 did_emsg = TRUE; /* flag for DoOneCmd() */ | 688 did_emsg = TRUE; /* flag for DoOneCmd() */ |
689 } | 689 } |
690 | 690 |
691 emsg_on_display = TRUE; /* remember there is an error message */ | 691 emsg_on_display = TRUE; /* remember there is an error message */ |
692 ++msg_scroll; /* don't overwrite a previous message */ | 692 ++msg_scroll; /* don't overwrite a previous message */ |
693 attr = hl_attr(HLF_E); /* set highlight mode for error messages */ | 693 attr = HL_ATTR(HLF_E); /* set highlight mode for error messages */ |
694 if (msg_scrolled != 0) | 694 if (msg_scrolled != 0) |
695 need_wait_return = TRUE; /* needed in case emsg() is called after | 695 need_wait_return = TRUE; /* needed in case emsg() is called after |
696 * wait_return has reset need_wait_return | 696 * wait_return has reset need_wait_return |
697 * and a redraw is expected because | 697 * and a redraw is expected because |
698 * msg_scrolled is non-zero */ | 698 * msg_scrolled is non-zero */ |
983 { | 983 { |
984 s = mch_getenv((char_u *)"LANG"); | 984 s = mch_getenv((char_u *)"LANG"); |
985 if (s != NULL && *s != NUL) | 985 if (s != NULL && *s != NUL) |
986 msg_attr((char_u *) | 986 msg_attr((char_u *) |
987 _("Messages maintainer: Bram Moolenaar <Bram@vim.org>"), | 987 _("Messages maintainer: Bram Moolenaar <Bram@vim.org>"), |
988 hl_attr(HLF_T)); | 988 HL_ATTR(HLF_T)); |
989 } | 989 } |
990 | 990 |
991 /* Display what was not skipped. */ | 991 /* Display what was not skipped. */ |
992 for (; p != NULL && !got_int; p = p->next) | 992 for (; p != NULL && !got_int; p = p->next) |
993 if (p->msg != NULL) | 993 if (p->msg != NULL) |
1278 if (msg_didout) /* start on a new line */ | 1278 if (msg_didout) /* start on a new line */ |
1279 msg_putchar('\n'); | 1279 msg_putchar('\n'); |
1280 if (got_int) | 1280 if (got_int) |
1281 MSG_PUTS(_("Interrupt: ")); | 1281 MSG_PUTS(_("Interrupt: ")); |
1282 | 1282 |
1283 MSG_PUTS_ATTR(_("Press ENTER or type command to continue"), hl_attr(HLF_R)); | 1283 MSG_PUTS_ATTR(_("Press ENTER or type command to continue"), HL_ATTR(HLF_R)); |
1284 if (!msg_use_printf()) | 1284 if (!msg_use_printf()) |
1285 msg_clr_eos(); | 1285 msg_clr_eos(); |
1286 p_more = save_p_more; | 1286 p_more = save_p_more; |
1287 } | 1287 } |
1288 | 1288 |
1429 | 1429 |
1430 #if defined(FEAT_FIND_ID) || defined(PROTO) | 1430 #if defined(FEAT_FIND_ID) || defined(PROTO) |
1431 void | 1431 void |
1432 msg_home_replace_hl(char_u *fname) | 1432 msg_home_replace_hl(char_u *fname) |
1433 { | 1433 { |
1434 msg_home_replace_attr(fname, hl_attr(HLF_D)); | 1434 msg_home_replace_attr(fname, HL_ATTR(HLF_D)); |
1435 } | 1435 } |
1436 #endif | 1436 #endif |
1437 | 1437 |
1438 static void | 1438 static void |
1439 msg_home_replace_attr(char_u *fname, int attr) | 1439 msg_home_replace_attr(char_u *fname, int attr) |
1542 * far and the translation of the unprintable char. */ | 1542 * far and the translation of the unprintable char. */ |
1543 if (str > plain_start) | 1543 if (str > plain_start) |
1544 msg_puts_attr_len(plain_start, (int)(str - plain_start), | 1544 msg_puts_attr_len(plain_start, (int)(str - plain_start), |
1545 attr); | 1545 attr); |
1546 plain_start = str + mb_l; | 1546 plain_start = str + mb_l; |
1547 msg_puts_attr(transchar(c), attr == 0 ? hl_attr(HLF_8) : attr); | 1547 msg_puts_attr(transchar(c), attr == 0 ? HL_ATTR(HLF_8) : attr); |
1548 retval += char2cells(c); | 1548 retval += char2cells(c); |
1549 } | 1549 } |
1550 len -= mb_l - 1; | 1550 len -= mb_l - 1; |
1551 str += mb_l; | 1551 str += mb_l; |
1552 } | 1552 } |
1560 * translation of the unprintable char. */ | 1560 * translation of the unprintable char. */ |
1561 if (str > plain_start) | 1561 if (str > plain_start) |
1562 msg_puts_attr_len(plain_start, (int)(str - plain_start), | 1562 msg_puts_attr_len(plain_start, (int)(str - plain_start), |
1563 attr); | 1563 attr); |
1564 plain_start = str + 1; | 1564 plain_start = str + 1; |
1565 msg_puts_attr(s, attr == 0 ? hl_attr(HLF_8) : attr); | 1565 msg_puts_attr(s, attr == 0 ? HL_ATTR(HLF_8) : attr); |
1566 retval += (int)STRLEN(s); | 1566 retval += (int)STRLEN(s); |
1567 } | 1567 } |
1568 else | 1568 else |
1569 ++retval; | 1569 ++retval; |
1570 ++str; | 1570 ++str; |
1621 int retval = 0; | 1621 int retval = 0; |
1622 char_u *string; | 1622 char_u *string; |
1623 int attr; | 1623 int attr; |
1624 int len; | 1624 int len; |
1625 | 1625 |
1626 attr = hl_attr(HLF_8); | 1626 attr = HL_ATTR(HLF_8); |
1627 while (*str != NUL) | 1627 while (*str != NUL) |
1628 { | 1628 { |
1629 /* Leading and trailing spaces need to be displayed in <> form. */ | 1629 /* Leading and trailing spaces need to be displayed in <> form. */ |
1630 if ((str == strstart || str[1] == NUL) && *str == ' ') | 1630 if ((str == strstart || str[1] == NUL) && *str == ' ') |
1631 { | 1631 { |
1844 } | 1844 } |
1845 else | 1845 else |
1846 { | 1846 { |
1847 c = lcs_tab1; | 1847 c = lcs_tab1; |
1848 c_extra = lcs_tab2; | 1848 c_extra = lcs_tab2; |
1849 attr = hl_attr(HLF_8); | 1849 attr = HL_ATTR(HLF_8); |
1850 } | 1850 } |
1851 } | 1851 } |
1852 else if (c == 160 && list && lcs_nbsp != NUL) | 1852 else if (c == 160 && list && lcs_nbsp != NUL) |
1853 { | 1853 { |
1854 c = lcs_nbsp; | 1854 c = lcs_nbsp; |
1855 attr = hl_attr(HLF_8); | 1855 attr = HL_ATTR(HLF_8); |
1856 } | 1856 } |
1857 else if (c == NUL && list && lcs_eol != NUL) | 1857 else if (c == NUL && list && lcs_eol != NUL) |
1858 { | 1858 { |
1859 p_extra = (char_u *)""; | 1859 p_extra = (char_u *)""; |
1860 c_extra = NUL; | 1860 c_extra = NUL; |
1861 n_extra = 1; | 1861 n_extra = 1; |
1862 c = lcs_eol; | 1862 c = lcs_eol; |
1863 attr = hl_attr(HLF_AT); | 1863 attr = HL_ATTR(HLF_AT); |
1864 --s; | 1864 --s; |
1865 } | 1865 } |
1866 else if (c != NUL && (n = byte2cells(c)) > 1) | 1866 else if (c != NUL && (n = byte2cells(c)) > 1) |
1867 { | 1867 { |
1868 n_extra = n - 1; | 1868 n_extra = n - 1; |
1869 p_extra = transchar_byte(c); | 1869 p_extra = transchar_byte(c); |
1870 c_extra = NUL; | 1870 c_extra = NUL; |
1871 c = *p_extra++; | 1871 c = *p_extra++; |
1872 /* Use special coloring to be able to distinguish <hex> from | 1872 /* Use special coloring to be able to distinguish <hex> from |
1873 * the same in plain text. */ | 1873 * the same in plain text. */ |
1874 attr = hl_attr(HLF_8); | 1874 attr = HL_ATTR(HLF_8); |
1875 } | 1875 } |
1876 else if (c == ' ' && trail != NULL && s > trail) | 1876 else if (c == ' ' && trail != NULL && s > trail) |
1877 { | 1877 { |
1878 c = lcs_trail; | 1878 c = lcs_trail; |
1879 attr = hl_attr(HLF_8); | 1879 attr = HL_ATTR(HLF_8); |
1880 } | 1880 } |
1881 else if (c == ' ' && list && lcs_space != NUL) | 1881 else if (c == ' ' && list && lcs_space != NUL) |
1882 { | 1882 { |
1883 c = lcs_space; | 1883 c = lcs_space; |
1884 attr = hl_attr(HLF_8); | 1884 attr = HL_ATTR(HLF_8); |
1885 } | 1885 } |
1886 } | 1886 } |
1887 | 1887 |
1888 if (c == NUL) | 1888 if (c == NUL) |
1889 break; | 1889 break; |
1911 cmdmsg_rl ? msg_col <= 1 : | 1911 cmdmsg_rl ? msg_col <= 1 : |
1912 #endif | 1912 #endif |
1913 msg_col == Columns - 1)) | 1913 msg_col == Columns - 1)) |
1914 { | 1914 { |
1915 /* Doesn't fit, print a highlighted '>' to fill it up. */ | 1915 /* Doesn't fit, print a highlighted '>' to fill it up. */ |
1916 msg_screen_putchar('>', hl_attr(HLF_AT)); | 1916 msg_screen_putchar('>', HL_ATTR(HLF_AT)); |
1917 return s; | 1917 return s; |
1918 } | 1918 } |
1919 | 1919 |
1920 screen_puts_len(s, l, msg_row, msg_col, attr); | 1920 screen_puts_len(s, l, msg_row, msg_col, attr); |
1921 #ifdef FEAT_RIGHTLEFT | 1921 #ifdef FEAT_RIGHTLEFT |
1954 | 1954 |
1955 void | 1955 void |
1956 msg_puts_title( | 1956 msg_puts_title( |
1957 char_u *s) | 1957 char_u *s) |
1958 { | 1958 { |
1959 msg_puts_attr(s, hl_attr(HLF_T)); | 1959 msg_puts_attr(s, HL_ATTR(HLF_T)); |
1960 } | 1960 } |
1961 | 1961 |
1962 /* | 1962 /* |
1963 * Show a message in such a way that it always fits in the line. Cut out a | 1963 * Show a message in such a way that it always fits in the line. Cut out a |
1964 * part in the middle and replace it with "..." when necessary. | 1964 * part in the middle and replace it with "..." when necessary. |
1979 room = Columns - msg_col; | 1979 room = Columns - msg_col; |
1980 if (len > room && room >= 20) | 1980 if (len > room && room >= 20) |
1981 { | 1981 { |
1982 slen = (room - 3) / 2; | 1982 slen = (room - 3) / 2; |
1983 msg_outtrans_len_attr(longstr, slen, attr); | 1983 msg_outtrans_len_attr(longstr, slen, attr); |
1984 msg_puts_attr((char_u *)"...", hl_attr(HLF_8)); | 1984 msg_puts_attr((char_u *)"...", HL_ATTR(HLF_8)); |
1985 } | 1985 } |
1986 msg_outtrans_len_attr(longstr + len - slen, slen, attr); | 1986 msg_outtrans_len_attr(longstr + len - slen, slen, attr); |
1987 } | 1987 } |
1988 | 1988 |
1989 /* | 1989 /* |
3065 msg_moremsg(int full) | 3065 msg_moremsg(int full) |
3066 { | 3066 { |
3067 int attr; | 3067 int attr; |
3068 char_u *s = (char_u *)_("-- More --"); | 3068 char_u *s = (char_u *)_("-- More --"); |
3069 | 3069 |
3070 attr = hl_attr(HLF_M); | 3070 attr = HL_ATTR(HLF_M); |
3071 screen_puts(s, (int)Rows - 1, 0, attr); | 3071 screen_puts(s, (int)Rows - 1, 0, attr); |
3072 if (full) | 3072 if (full) |
3073 screen_puts((char_u *) | 3073 screen_puts((char_u *) |
3074 _(" SPACE/d/j: screen/page/line down, b/u/k: up, q: quit "), | 3074 _(" SPACE/d/j: screen/page/line down, b/u/k: up, q: quit "), |
3075 (int)Rows - 1, vim_strsize(s), attr); | 3075 (int)Rows - 1, vim_strsize(s), attr); |
3418 set_vim_var_string(VV_WARNINGMSG, message, -1); | 3418 set_vim_var_string(VV_WARNINGMSG, message, -1); |
3419 #endif | 3419 #endif |
3420 vim_free(keep_msg); | 3420 vim_free(keep_msg); |
3421 keep_msg = NULL; | 3421 keep_msg = NULL; |
3422 if (hl) | 3422 if (hl) |
3423 keep_msg_attr = hl_attr(HLF_W); | 3423 keep_msg_attr = HL_ATTR(HLF_W); |
3424 else | 3424 else |
3425 keep_msg_attr = 0; | 3425 keep_msg_attr = 0; |
3426 if (msg_attr(message, keep_msg_attr) && msg_scrolled == 0) | 3426 if (msg_attr(message, keep_msg_attr) && msg_scrolled == 0) |
3427 set_keep_msg(message, keep_msg_attr); | 3427 set_keep_msg(message, keep_msg_attr); |
3428 msg_didout = FALSE; /* overwrite this message */ | 3428 msg_didout = FALSE; /* overwrite this message */ |
3810 display_confirm_msg(void) | 3810 display_confirm_msg(void) |
3811 { | 3811 { |
3812 /* avoid that 'q' at the more prompt truncates the message here */ | 3812 /* avoid that 'q' at the more prompt truncates the message here */ |
3813 ++confirm_msg_used; | 3813 ++confirm_msg_used; |
3814 if (confirm_msg != NULL) | 3814 if (confirm_msg != NULL) |
3815 msg_puts_attr(confirm_msg, hl_attr(HLF_M)); | 3815 msg_puts_attr(confirm_msg, HL_ATTR(HLF_M)); |
3816 --confirm_msg_used; | 3816 --confirm_msg_used; |
3817 } | 3817 } |
3818 | 3818 |
3819 #endif /* FEAT_CON_DIALOG */ | 3819 #endif /* FEAT_CON_DIALOG */ |
3820 | 3820 |