diff options
author | bfredl <bjorn.linse@gmail.com> | 2023-09-27 23:49:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-27 23:49:47 +0200 |
commit | e46f5aab895f333d23d6adf490e13177c8d3c1d8 (patch) | |
tree | e0bf5224a8db9e9cb4b60347cfd4ac7f8faacbaf /src | |
parent | 86b7d8a9f54d572e6866d6a24476d2369a288f79 (diff) | |
parent | 448d4837be7f7bd60ac0b5a3100c0217ac48a495 (diff) | |
download | rneovim-e46f5aab895f333d23d6adf490e13177c8d3c1d8.tar.gz rneovim-e46f5aab895f333d23d6adf490e13177c8d3c1d8.tar.bz2 rneovim-e46f5aab895f333d23d6adf490e13177c8d3c1d8.zip |
Merge pull request #25396 from bfredl/no_attr
refactor(messages): fold msg() functions with and without attr
Diffstat (limited to 'src')
42 files changed, 382 insertions, 413 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 00641c633d..c55f9592bf 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -1699,21 +1699,26 @@ static void write_msg(String message, bool to_err, bool writeln) { static StringBuilder out_line_buf = KV_INITIAL_VALUE; static StringBuilder err_line_buf = KV_INITIAL_VALUE; + StringBuilder *line_buf = to_err ? &err_line_buf : &out_line_buf; -#define PUSH_CHAR(c, line_buf, msg) \ - if (kv_max(line_buf) == 0) { \ - kv_resize(line_buf, LINE_BUFFER_MIN_SIZE); \ +#define PUSH_CHAR(c) \ + if (kv_max(*line_buf) == 0) { \ + kv_resize(*line_buf, LINE_BUFFER_MIN_SIZE); \ } \ if (c == NL) { \ - kv_push(line_buf, NUL); \ - msg(line_buf.items); \ + kv_push(*line_buf, NUL); \ + if (to_err) { \ + emsg(line_buf->items); \ + } else { \ + msg(line_buf->items, 0); \ + } \ msg_didout = true; \ - kv_drop(line_buf, kv_size(line_buf)); \ - kv_resize(line_buf, LINE_BUFFER_MIN_SIZE); \ + kv_drop(*line_buf, kv_size(*line_buf)); \ + kv_resize(*line_buf, LINE_BUFFER_MIN_SIZE); \ } else if (c == NUL) { \ - kv_push(line_buf, NL); \ + kv_push(*line_buf, NL); \ } else { \ - kv_push(line_buf, c); \ + kv_push(*line_buf, c); \ } no_wait_return++; @@ -1721,18 +1726,10 @@ static void write_msg(String message, bool to_err, bool writeln) if (got_int) { break; } - if (to_err) { - PUSH_CHAR(message.data[i], err_line_buf, emsg); - } else { - PUSH_CHAR(message.data[i], out_line_buf, msg); - } + PUSH_CHAR(message.data[i]); } if (writeln) { - if (to_err) { - PUSH_CHAR(NL, err_line_buf, emsg); - } else { - PUSH_CHAR(NL, out_line_buf, msg); - } + PUSH_CHAR(NL); } no_wait_return--; msg_end(); diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c index ff0c2f063f..f2408a9457 100644 --- a/src/nvim/autocmd.c +++ b/src/nvim/autocmd.c @@ -228,7 +228,7 @@ static void au_show_for_event(int group, event_T event, const char *pat) } msg_col = 4; - msg_outtrans(ac->pat->pat); + msg_outtrans(ac->pat->pat, 0); } if (got_int) { @@ -253,12 +253,12 @@ static void au_show_for_event(int group, event_T event, const char *pat) } else { snprintf(msg, msglen, "%s [%s]", exec_to_string, ac->desc); } - msg_outtrans(msg); + msg_outtrans(msg, 0); XFREE_CLEAR(msg); } else if (ac->exec.type == CALLABLE_CB) { msg_puts_attr(exec_to_string, HL_ATTR(HLF_8)); } else { - msg_outtrans(exec_to_string); + msg_outtrans(exec_to_string, 0); } XFREE_CLEAR(exec_to_string); if (p_verbose > 0) { diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 15fbf7df7b..87096767f9 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -2858,7 +2858,7 @@ void buflist_list(exarg_T *eap) buf == curbuf ? (int64_t)curwin->w_cursor.lnum : (int64_t)buflist_findlnum(buf)); } - msg_outtrans(IObuff); + msg_outtrans(IObuff, 0); line_breakcheck(); } @@ -3230,10 +3230,10 @@ void fileinfo(int fullname, int shorthelp, int dont_truncate) msg_start(); n = msg_scroll; msg_scroll = true; - msg(buffer); + msg(buffer, 0); msg_scroll = n; } else { - p = msg_trunc_attr(buffer, false, 0); + p = msg_trunc(buffer, false, 0); if (restart_edit != 0 || (msg_scrolled && !need_wait_return)) { // Need to repeat the message after redrawing when: // - When restart_edit is set (otherwise there will be a delay diff --git a/src/nvim/bufwrite.c b/src/nvim/bufwrite.c index 2f13586dcc..770c269b0e 100644 --- a/src/nvim/bufwrite.c +++ b/src/nvim/bufwrite.c @@ -352,8 +352,7 @@ static int check_mtime(buf_T *buf, FileInfo *file_info) msg_scroll = true; // Don't overwrite messages here. msg_silent = 0; // Must give this prompt. // Don't use emsg() here, don't want to flush the buffers. - msg_attr(_("WARNING: The file has been changed since reading it!!!"), - HL_ATTR(HLF_E)); + msg(_("WARNING: The file has been changed since reading it!!!"), HL_ATTR(HLF_E)); if (ask_yesno(_("Do you really want to write to it"), true) == 'n') { return FAIL; } @@ -1721,7 +1720,7 @@ restore_backup: // This may take a while, if we were interrupted let the user // know we got the message. if (got_int) { - msg(_(e_interr)); + msg(_(e_interr), 0); ui_flush(); } @@ -1786,7 +1785,7 @@ restore_backup: } } - set_keep_msg(msg_trunc_attr(IObuff, false, 0), 0); + set_keep_msg(msg_trunc(IObuff, false, 0), 0); } // When written everything correctly: reset 'modified'. Unless not diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c index 4da6c3c8ba..290cc336b8 100644 --- a/src/nvim/cmdexpand.c +++ b/src/nvim/cmdexpand.c @@ -971,7 +971,7 @@ static void showmatches_oneline(expand_T *xp, char **matches, int numMatches, in int lastlen = 999; for (int j = linenr; j < numMatches; j += lines) { if (xp->xp_context == EXPAND_TAGS_LISTFILES) { - msg_outtrans_attr(matches[j], HL_ATTR(HLF_D)); + msg_outtrans(matches[j], HL_ATTR(HLF_D)); p = matches[j] + strlen(matches[j]) + 1; msg_advance(maxlen + 1); msg_puts(p); @@ -1013,7 +1013,7 @@ static void showmatches_oneline(expand_T *xp, char **matches, int numMatches, in isdir = false; p = SHOW_MATCH(j); } - lastlen = msg_outtrans_attr(p, isdir ? dir_attr : 0); + lastlen = msg_outtrans(p, isdir ? dir_attr : 0); } if (msg_col > 0) { // when not wrapped around msg_clr_eos(); diff --git a/src/nvim/cmdhist.c b/src/nvim/cmdhist.c index 072898706b..72379fd86d 100644 --- a/src/nvim/cmdhist.c +++ b/src/nvim/cmdhist.c @@ -610,7 +610,7 @@ void ex_history(exarg_T *eap) char *arg = eap->arg; if (hislen == 0) { - msg(_("'history' option is zero")); + msg(_("'history' option is zero"), 0); return; } @@ -672,7 +672,7 @@ void ex_history(exarg_T *eap) } else { xstrlcat(IObuff, hist[i].hisstr, IOSIZE); } - msg_outtrans(IObuff); + msg_outtrans(IObuff, 0); } if (i == idx) { break; diff --git a/src/nvim/debugger.c b/src/nvim/debugger.c index 1b1dea0d62..86ad70196d 100644 --- a/src/nvim/debugger.c +++ b/src/nvim/debugger.c @@ -102,7 +102,7 @@ void do_debug(char *cmd) debug_mode = true; if (!debug_did_msg) { - msg(_("Entering Debug mode. Type \"cont\" to continue.")); + msg(_("Entering Debug mode. Type \"cont\" to continue."), 0); } if (debug_oldval != NULL) { smsg(_("Oldval = \"%s\""), debug_oldval); @@ -116,7 +116,7 @@ void do_debug(char *cmd) } char *sname = estack_sfile(ESTACK_NONE); if (sname != NULL) { - msg(sname); + msg(sname, 0); } xfree(sname); if (SOURCING_LNUM != 0) { @@ -345,7 +345,7 @@ static void do_checkbacktracelevel(void) { if (debug_backtrace_level < 0) { debug_backtrace_level = 0; - msg(_("frame is zero")); + msg(_("frame is zero"), 0); } else { char *sname = estack_sfile(ESTACK_NONE); int max = get_maxbacktrace_level(sname); @@ -719,7 +719,7 @@ void ex_breakdel(exarg_T *eap) void ex_breaklist(exarg_T *eap) { if (GA_EMPTY(&dbg_breakp)) { - msg(_("No breakpoints defined")); + msg(_("No breakpoints defined"), 0); return; } diff --git a/src/nvim/digraph.c b/src/nvim/digraph.c index 7a690d889f..69a4676148 100644 --- a/src/nvim/digraph.c +++ b/src/nvim/digraph.c @@ -1706,7 +1706,7 @@ static void digraph_header(const char *msg) if (msg_col > 0) { msg_putchar('\n'); } - msg_outtrans_attr(msg, HL_ATTR(HLF_CM)); + msg_outtrans(msg, HL_ATTR(HLF_CM)); msg_putchar('\n'); } @@ -1860,7 +1860,7 @@ static void printdigraph(const digr_T *dp, result_T *previous) *p++ = (char)dp->char2; *p++ = ' '; *p = NUL; - msg_outtrans(buf); + msg_outtrans(buf, 0); p = buf; // add a space to draw a composing char on @@ -1870,14 +1870,14 @@ static void printdigraph(const digr_T *dp, result_T *previous) p += utf_char2bytes(dp->result, p); *p = NUL; - msg_outtrans_attr(buf, HL_ATTR(HLF_8)); + msg_outtrans(buf, HL_ATTR(HLF_8)); p = buf; if (char2cells(dp->result) == 1) { *p++ = ' '; } assert(p >= buf); vim_snprintf(p, sizeof(buf) - (size_t)(p - buf), " %3d", dp->result); - msg_outtrans(buf); + msg_outtrans(buf, 0); } /// Get the two digraph characters from a typval. diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 8def1bf35d..1b5428e153 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -3492,7 +3492,7 @@ static bool ins_esc(long *count, int cmdchar, bool nomove) showmode(); } else if (p_smd && (got_int || !skip_showmode()) && !(p_ch == 0 && !ui_has(kUIMessages))) { - msg(""); + msg("", 0); } // Exit Insert mode return true; diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 21c7cdee7d..f7614af548 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -8018,7 +8018,7 @@ void ex_echo(exarg_T *eap) char *tofree = encode_tv2echo(&rettv, NULL); if (*tofree != NUL) { msg_ext_set_kind("echo"); - msg_multiline_attr(tofree, echo_attr, true, &need_clear); + msg_multiline(tofree, echo_attr, true, &need_clear); } xfree(tofree); } @@ -8102,7 +8102,7 @@ void ex_execute(exarg_T *eap) if (eap->cmdidx == CMD_echomsg) { msg_ext_set_kind("echomsg"); - msg_attr(ga.ga_data, echo_attr); + msg(ga.ga_data, echo_attr); } else if (eap->cmdidx == CMD_echoerr) { // We don't want to abort following commands, restore did_emsg. int save_did_emsg = did_emsg; diff --git a/src/nvim/eval/vars.c b/src/nvim/eval/vars.c index 5d1da956ee..8273e8434d 100644 --- a/src/nvim/eval/vars.c +++ b/src/nvim/eval/vars.c @@ -1352,7 +1352,7 @@ static void list_one_var(dictitem_T *v, const char *prefix, int *first) static void list_one_var_a(const char *prefix, const char *name, const ptrdiff_t name_len, const VarType type, const char *string, int *first) { - // don't use msg() or msg_attr() to avoid overwriting "v:statusmsg" + // don't use msg() to avoid overwriting "v:statusmsg" msg_start(); msg_puts(prefix); if (name != NULL) { // "a:" vars don't have a name stored @@ -1378,7 +1378,7 @@ static void list_one_var_a(const char *prefix, const char *name, const ptrdiff_t msg_putchar(' '); } - msg_outtrans(string); + msg_outtrans(string, 0); if (type == VAR_FUNC || type == VAR_PARTIAL) { msg_puts("()"); diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index dc7136196e..9eea29b3a2 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -135,7 +135,7 @@ void do_ascii(const exarg_T *const eap) int cc[MAX_MCO]; int c = utfc_ptr2char(get_cursor_pos_ptr(), cc); if (c == NUL) { - msg("NUL"); + msg("NUL", 0); return; } @@ -233,7 +233,7 @@ void do_ascii(const exarg_T *const eap) xstrlcpy(IObuff + iobuff_len, " ...", sizeof(IObuff) - iobuff_len); } - msg(IObuff); + msg(IObuff, 0); } /// ":left", ":center" and ":right": align text. @@ -1062,7 +1062,7 @@ void do_bang(int addr_count, exarg_T *eap, bool forceit, bool do_in, bool do_out msg_start(); msg_putchar(':'); msg_putchar('!'); - msg_outtrans(newcmd); + msg_outtrans(newcmd, 0); msg_clr_eos(); ui_cursor_goto(msg_row, msg_col); @@ -1274,7 +1274,7 @@ static void do_filter(linenr_T line1, linenr_T line2, exarg_T *eap, char *cmd, b if (do_in) { vim_snprintf(msg_buf, sizeof(msg_buf), _("%" PRId64 " lines filtered"), (int64_t)linecount); - if (msg(msg_buf) && !msg_scroll) { + if (msg(msg_buf, 0) && !msg_scroll) { // save message to display it after redraw set_keep_msg(msg_buf, 0); } @@ -4250,7 +4250,7 @@ skip: } } if (cmdpreview_ns <= 0 && !do_sub_msg(subflags.do_count) && subflags.do_ask && p_ch > 0) { - msg(""); + msg("", 0); } } else { global_need_beginline = true; @@ -4265,7 +4265,7 @@ skip: } else if (got_match) { // did find something but nothing substituted if (p_ch > 0) { - msg(""); + msg("", 0); } } else if (subflags.do_error) { // nothing found @@ -4339,7 +4339,7 @@ bool do_sub_msg(bool count_only) vim_snprintf_add(msg_buf, sizeof(msg_buf), NGETTEXT(msg_single, msg_plural, sub_nlines), (int64_t)sub_nsubs, (int64_t)sub_nlines); - if (msg(msg_buf)) { + if (msg(msg_buf, 0)) { // save message to display it after redraw set_keep_msg(msg_buf, 0); } @@ -4468,7 +4468,7 @@ void ex_global(exarg_T *eap) // pass 2: execute the command for each line that has been marked if (got_int) { - msg(_(e_interr)); + msg(_(e_interr), 0); } else if (ndone == 0) { if (type == 'v') { smsg(_("Pattern found in every line: %s"), used_pat); @@ -4775,7 +4775,7 @@ void ex_oldfiles(exarg_T *eap) long nr = 0; if (l == NULL) { - msg(_("No old files")); + msg(_("No old files"), 0); return; } @@ -4790,7 +4790,7 @@ void ex_oldfiles(exarg_T *eap) if (!message_filtered(fname)) { msg_outnum(nr); msg_puts(": "); - msg_outtrans(tv_get_string(TV_LIST_ITEM_TV(li))); + msg_outtrans(tv_get_string(TV_LIST_ITEM_TV(li)), 0); msg_clr_eos(); msg_putchar('\n'); os_breakcheck(); diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 86934a645a..84ca0faf88 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -443,7 +443,7 @@ int buf_write_all(buf_T *buf, int forceit) false, forceit, true, false)); if (curbuf != old_curbuf) { msg_source(HL_ATTR(HLF_W)); - msg(_("Warning: Entered other buffer unexpectedly (check autocommands)")); + msg(_("Warning: Entered other buffer unexpectedly (check autocommands)"), 0); } return retval; } diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index ea93d0fe91..933de23316 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -209,7 +209,7 @@ void do_exmode(void) RedrawingDisabled++; // don't redisplay the window no_wait_return++; // don't wait for return - msg(_("Entering Ex mode. Type \"visual\" to go to Normal mode.")); + msg(_("Entering Ex mode. Type \"visual\" to go to Normal mode."), 0); while (exmode_active) { // Check for a ":normal" command and no more characters left. if (ex_normal_busy > 0 && typebuf.tb_len == 0) { @@ -4467,10 +4467,10 @@ static void ex_colorscheme(exarg_T *eap) xfree(expr); if (p != NULL) { - msg(p); + msg(p, 0); xfree(p); } else { - msg("default"); + msg("default", 0); } } else if (load_colors(eap->arg) == FAIL) { semsg(_("E185: Cannot find color scheme '%s'"), eap->arg); @@ -4480,7 +4480,7 @@ static void ex_colorscheme(exarg_T *eap) static void ex_highlight(exarg_T *eap) { if (*eap->arg == NUL && eap->cmd[2] == '!') { - msg(_("Greetings, Vim user!")); + msg(_("Greetings, Vim user!"), 0); } do_highlight(eap->arg, eap->forceit, false); } @@ -4751,7 +4751,7 @@ static void ex_tabonly(exarg_T *eap) } if (first_tabpage->tp_next == NULL) { - msg(_("Already only one tab page")); + msg(_("Already only one tab page"), 0); return; } @@ -5137,7 +5137,7 @@ static void ex_tabs(exarg_T *eap) msg_putchar('\n'); vim_snprintf(IObuff, IOSIZE, _("Tab page %d"), tabcount++); - msg_outtrans_attr(IObuff, HL_ATTR(HLF_T)); + msg_outtrans(IObuff, HL_ATTR(HLF_T)); os_breakcheck(); FOR_ALL_WINDOWS_IN_TAB(wp, tp) { @@ -5155,7 +5155,7 @@ static void ex_tabs(exarg_T *eap) } else { home_replace(wp->w_buffer, wp->w_buffer->b_fname, IObuff, IOSIZE, true); } - msg_outtrans(IObuff); + msg_outtrans(IObuff, 0); os_breakcheck(); } } @@ -5378,9 +5378,9 @@ static void ex_popup(exarg_T *eap) static void ex_swapname(exarg_T *eap) { if (curbuf->b_ml.ml_mfp == NULL || curbuf->b_ml.ml_mfp->mf_fname == NULL) { - msg(_("No swap file")); + msg(_("No swap file"), 0); } else { - msg(curbuf->b_ml.ml_mfp->mf_fname); + msg(curbuf->b_ml.ml_mfp->mf_fname, 0); } } @@ -5694,7 +5694,7 @@ static void ex_pwd(exarg_T *eap) } smsg("[%s] %s", context, NameBuff); } else { - msg(NameBuff); + msg(NameBuff, 0); } } else { emsg(_("E187: Unknown")); @@ -7360,289 +7360,290 @@ void verify_command(char *cmd) if (strcmp("smile", cmd) != 0) { return; // acceptable non-existing command } + int a = HL_ATTR(HLF_E); msg(" #xxn` #xnxx` ,+x@##@Mz;` .xxx" - "xxxxxxnz+, znnnnnnnnnnnnnnnn."); + "xxxxxxnz+, znnnnnnnnnnnnnnnn.", a); msg(" n###z x####` :x##########W+` ,###" - "##########M; W################."); + "##########M; W################.", a); msg(" n####; x####` `z##############W: ,###" - "############# W################."); + "############# W################.", a); msg(" n####W. x####` ,W#################+ ,###" - "############## W################."); + "############## W################.", a); msg(" n#####n x####` @################### ,###" - "##############i W################."); + "##############i W################.", a); msg(" n######i x####` .#########@W@########* ,###" - "##############W`W################."); + "##############W`W################.", a); msg(" n######@. x####` x######W*. `;n#######: ,###" - "#x,,,,:*M######iW###@:,,,,,,,,,,,`"); + "#x,,,,:*M######iW###@:,,,,,,,,,,,`", a); msg(" n#######n x####` *######+` :M#####M ,###" - "#n `x#####xW###@`"); + "#n `x#####xW###@`", a); msg(" n########* x####``@####@; `x#####i ,###" - "#n ,#####@W###@`"); + "#n ,#####@W###@`", a); msg(" n########@ x####`*#####i `M####M ,###" - "#n x#########@`"); + "#n x#########@`", a); msg(" n######### x####`M####z :#####:,###" - "#n z#########@`"); + "#n z#########@`", a); msg(" n#########* x####,#####. n####+,###" - "#n n#########@`"); + "#n n#########@`", a); msg(" n####@####@, x####i####x ;####x,###" - "#n `W#####@####+++++++++++i"); + "#n `W#####@####+++++++++++i", a); msg(" n####*#####M` x#########* `####@,###" - "#n i#####MW###############W"); + "#n i#####MW###############W", a); msg(" n####.######+ x####z####; W####,###" - "#n i@######W###############W"); + "#n i@######W###############W", a); msg(" n####.`W#####: x####n####: M####:###" - "#@nnnnnW#######,W###############W"); + "#@nnnnnW#######,W###############W", a); msg(" n####. :#####M`x####z####; W####,###" - "##############z W###############W"); + "##############z W###############W", a); msg(" n####. #######x#########* `####W,###" - "#############W` W###############W"); + "#############W` W###############W", a); msg(" n####. `M#####W####i####x ;####x,###" - "############W, W####+**********i"); + "############W, W####+**********i", a); msg(" n####. ,##########,#####. n####+,###" - "###########n. W###@`"); + "###########n. W###@`", a); msg(" n####. ##########`M####z :#####:,###" - "########Wz: W###@`"); + "########Wz: W###@`", a); msg(" n####. x#########`*#####i `M####M ,###" - "#x.....` W###@`"); + "#x.....` W###@`", a); msg(" n####. ,@########``@####@; `x#####i ,###" - "#n W###@`"); + "#n W###@`", a); msg(" n####. *########` *#####@+` ,M#####M ,###" - "#n W###@`"); + "#n W###@`", a); msg(" n####. x#######` x######W*. `;n######@: ,###" - "#n W###@,,,,,,,,,,,,`"); + "#n W###@,,,,,,,,,,,,`", a); msg(" n####. .@######` .#########@W@########* ,###" - "#n W################,"); + "#n W################,", a); msg(" n####. i######` @################### ,###" - "#n W################,"); + "#n W################,", a); msg(" n####. n#####` ,W#################+ ,###" - "#n W################,"); + "#n W################,", a); msg(" n####. .@####` .n##############W; ,###" - "#n W################,"); + "#n W################,", a); msg(" n####. i####` :x##########W+` ,###" - "#n W################,"); + "#n W################,", a); msg(" +nnnn` +nnn` ,+x@##@Mz;` .nnn" - "n+ zxxxxxxxxxxxxxxxx."); - msg(" "); + "n+ zxxxxxxxxxxxxxxxx.", a); + msg(" ", a); msg(" " - " ,+M@#Mi"); + " ,+M@#Mi", a); msg(" " - " .z########"); + " .z########", a); msg(" " - " i@#########i"); + " i@#########i", a); msg(" " - " `############W`"); + " `############W`", a); msg(" " - " `n#############i"); + " `n#############i", a); msg(" " - " `n##############n"); + " `n##############n", a); msg(" `` " - " z###############@`"); + " z###############@`", a); msg(" `W@z, " - " ##################,"); + " ##################,", a); msg(" *#####` " - " i############@x@###i"); + " i############@x@###i", a); msg(" ######M. " - " :#############n`,W##+"); + " :#############n`,W##+", a); msg(" +######@: " - " .W#########M@##+ *##z"); + " .W#########M@##+ *##z", a); msg(" :#######@: " - " `x########@#x###* ,##n"); + " `x########@#x###* ,##n", a); msg(" `@#######@; " - " z#########M*@nW#i .##x"); + " z#########M*@nW#i .##x", a); msg(" z########@i " - " *###########WM#@#, `##x"); + " *###########WM#@#, `##x", a); msg(" i##########+ " - " ;###########*n###@ `##x"); + " ;###########*n###@ `##x", a); msg(" `@#MM#######x, " - " ,@#########zM,`z##M `@#x"); + " ,@#########zM,`z##M `@#x", a); msg(" n##M#W#######n. " - " `.:i*+#zzzz##+i:.` ,W#########Wii,`n@#@` n@##n"); + " `.:i*+#zzzz##+i:.` ,W#########Wii,`n@#@` n@##n", a); msg(" ;###@#x#######n `,i" - "#nW@#####@@WWW@@####@Mzi. ,W##########@z.. ;zM#+i####z"); + "#nW@#####@@WWW@@####@Mzi. ,W##########@z.. ;zM#+i####z", a); msg(" x####nz######## .;#x@##" - "@Wn#*;,.` ``,:*#x@##M+, ;@########xz@WM+#` `n@#######"); + "@Wn#*;,.` ``,:*#x@##M+, ;@########xz@WM+#` `n@#######", a); msg(" ,@####M########xi#@##@Mzi," - "` .+x###Mi:n##########Mz```.:i *@######*"); + "` .+x###Mi:n##########Mz```.:i *@######*", a); msg(" *#####W#########ix+:` " - " :n#############z: `*.`M######i"); + " :n#############z: `*.`M######i", a); msg(" i#W##nW@+@##@#M@; " - " ;W@@##########W, i`x@#####,"); + " ;W@@##########W, i`x@#####,", a); msg(" `@@n@Wn#@iMW*#*: " - " `iz#z@######x. M######`"); + " `iz#z@######x. M######`", a); msg(" z##zM###x`*, .` " - " `iW#####W;:` +#####M"); + " `iW#####W;:` +#####M", a); msg(" ,###nn##n` " - " ,#####x;` ,;@######"); + " ,#####x;` ,;@######", a); msg(" x###xz#. " - " in###+ `:######@."); + " in###+ `:######@.", a); msg(" ;####n+ " - " `Mnx##xi` , zM#######"); + " `Mnx##xi` , zM#######", a); msg(" `W####+ " - "i. `.+x###@#. :n,z######:"); + "i. `.+x###@#. :n,z######:", a); msg(" z####@` ;" - "#: .ii@###@;.*M*z####@`"); + "#: .ii@###@;.*M*z####@`", a); msg(" i####M ` `i@" - "#, :: +#n##@+@##W####n"); + "#, :: +#n##@+@##W####n", a); msg(" :####x ,i. ##xzM###" - "@` i. .@@, .z####x#######*"); + "@` i. .@@, .z####x#######*", a); msg(" ,###W; i##Wz########" - "# :## z##n ,@########x###:"); + "# :## z##n ,@########x###:", a); msg(" n##n `W###########M" - "`;n, i#x ,###@i *W########W#@`"); + "`;n, i#x ,###@i *W########W#@`", a); msg(" .@##+ `x###########@." - " z#+ .M#W``x#####n` `;#######@z#x"); + " z#+ .M#W``x#####n` `;#######@z#x", a); msg(" n###z :W############@ " - " z#* @##xM#######@n; `########nW+"); + " z#* @##xM#######@n; `########nW+", a); msg(" ;####nW##############W " - ":@#* `@#############* :########z@i`"); + ":@#* `@#############* :########z@i`", a); msg(" M##################### " - "M##: @#############@: *W########M#"); + "M##: @#############@: *W########M#", a); msg(" ;#####################i." - "##x` W#############W, :n########zx"); + "##x` W#############W, :n########zx", a); msg(" x####################@.`" - "x; @#############z. .@########W#"); + "x; @#############z. .@########W#", a); msg(" ,######################` " - " W###############x*,` W######zM#i"); + " W###############x*,` W######zM#i", a); msg(" #######################: " - " z##################@x+*#zzi `@#########."); + " z##################@x+*#zzi `@#########.", a); msg(" W########W#z#M#########; " - " *##########################z :@#######@`"); + " *##########################z :@#######@`", a); msg(" `@#######x`;#z ,x#######; " - " z###########M###xnM@########* :M######@"); + " z###########M###xnM@########* :M######@", a); msg(" i########, x#@` z######; " - " *##########i *#@` `+########+` n######."); + " *##########i *#@` `+########+` n######.", a); msg(" n#######@` M##, `W#####. " - " *#########z ###; z########M: :W####n"); + " *#########z ###; z########M: :W####n", a); msg(" M#######M n##. x####x " - " `x########: z##+ M#########@; .n###+"); + " `x########: z##+ M#########@; .n###+", a); msg(" W#######@` :#W `@####: " - " `@######W i### ;###########@. n##n"); + " `@######W i### ;###########@. n##n", a); msg(" W########z` ,, .x####z " - " @######@` `W#; `W############* *###;"); + " @######@` `W#; `W############* *###;", a); msg(" `@#########Mi,:*n@####W` " - " W#######* .. `n#############i i###x"); + " W#######* .. `n#############i i###x", a); msg(" .#####################z " - " `@#######@*` .x############n:` ;####."); + " `@#######@*` .x############n:` ;####.", a); msg(" :####################x`,,` " - " `W#########@x#+#@#############i ,####:"); + " `W#########@x#+#@#############i ,####:", a); msg(" ;###################x#@###x" - "i` *############################: `####i"); + "i` *############################: `####i", a); msg(" i##################+#######" - "#M, x##########################@` W###i"); + "#M, x##########################@` W###i", a); msg(" *################@; @######" - "##@, .W#########################@ x###:"); + "##@, .W#########################@ x###:", a); msg(" .+M#############z. M######" - "###x ,W########################@` ####."); + "###x ,W########################@` ####.", a); msg(" *M*;z@########x: :W#####" - "##i .M########################i i###:"); + "##i .M########################i i###:", a); msg(" *##@z;#@####x: :z###" - "@i `########################x .###;"); + "@i `########################x .###;", a); msg(" *#####n;#@## ;##" - "* ,x#####################@` W##*"); + "* ,x#####################@` W##*", a); msg(" *#######n;* :M##" - "W*, *W####################` n##z"); + "W*, *W####################` n##z", a); msg(" i########@. ,*n####" - "###M*` `###################M *##M"); + "###M*` `###################M *##M", a); msg(" i########n `z#####@@" - "#####Wi ,M################; ,##@`"); + "#####Wi ,M################; ,##@`", a); msg(" ;WMWW@###* .x##@ni.``" - ".:+zW##z` `n##############z @##,"); + ".:+zW##z` `n##############z @##,", a); msg(" .*++*i;;;. .M#@+` " - " .##n `x############x` n##i"); + " .##n `x############x` n##i", a); msg(" :########* x#W, " - " *#+ *###########M` +##+"); + " *#+ *###########M` +##+", a); msg(" ,######### :#@: " - " ##: #nzzzzzzzzzz. :##x"); + " ##: #nzzzzzzzzzz. :##x", a); msg(" .#####Wz+` ##+ " - " `MM` .znnnnnnnnn. `@#@`"); + " `MM` .znnnnnnnnn. `@#@`", a); msg(" `@@ni;*nMz` @W` " - " :#+ .x#######n x##,"); + " :#+ .x#######n x##,", a); msg(" i;z@#####, .#* " - " z#: ;;;*zW##; ###i"); + " z#: ;;;*zW##; ###i", a); msg(" z########: :#; " - " `Wx +###Wni;n. ;##z"); + " `Wx +###Wni;n. ;##z", a); msg(" n########W: .#* " - " ,#, ;#######@+ `@#M"); + " ,#, ;#######@+ `@#M", a); msg(" .###########n;.MM " - " n* ;iM#######* x#@`"); + " n* ;iM#######* x#@`", a); msg(" :#############@;; " - " .n` ,#W*iW#####W` +##,"); + " .n` ,#W*iW#####W` +##,", a); msg(" ,##############. " - " ix. `x###M;####### ,##i"); + " ix. `x###M;####### ,##i", a); msg(" .#############@` " - " x@n**#W######z;M###@. W##"); + " x@n**#W######z;M###@. W##", a); msg(" .##############W: " - " .x############@*;zW#; z#x"); + " .x############@*;zW#; z#x", a); msg(" ,###############@; " - " `##############@n*;. i#@"); + " `##############@n*;. i#@", a); msg(" ,#################i " - " :n##############W` .##,"); + " :n##############W` .##,", a); msg(" ,###################` " - " .+W##########W, `##i"); + " .+W##########W, `##i", a); msg(" :###################@zi,` " - " ;zM@@@WMn*` @#z"); + " ;zM@@@WMn*` @#z", a); msg(" :#######################@x+" - "*i;;:i#M, `` M#W"); + "*i;;:i#M, `` M#W", a); msg(" ;##########################" - "######@x. n##,"); + "######@x. n##,", a); msg(" i#####################@W@@@" - "@Wxz*:` *##+"); + "@Wxz*:` *##+", a); msg(" *######################+```" - " :##M"); + " :##M", a); msg(" ########################M; " - " `@##,"); + " `@##,", a); msg(" z#########################x" - ", z###"); + ", z###", a); msg(" n##########################" - "#n: ;##W`"); + "#n: ;##W`", a); msg(" x##########################" - "###Mz#++##* `W##i"); + "###Mz#++##* `W##i", a); msg(" M##########################" - "##########@` ###x"); + "##########@` ###x", a); msg(" W##########################" - "###########` .###,"); + "###########` .###,", a); msg(" @##########################" - "##########M n##z"); + "##########M n##z", a); msg(" @##################z*i@WMMM" - "x#x@#####,. :##@."); + "x#x@#####,. :##@.", a); msg(" `#####################@xi` " - " `::,* x##+"); + " `::,* x##+", a); msg(" .#####################@#M. " - " ;##@`"); + " ;##@`", a); msg(" ,#####################:. " - " M##i"); + " M##i", a); msg(" ;###################ni` " - " i##M"); + " i##M", a); msg(" *#################W#` " - " `W##,"); + " `W##,", a); msg(" z#################@Wx+. " - " +###"); + " +###", a); msg(" x######################z. " - " .@#@`"); + " .@#@`", a); msg(" `@#######################@; " - " z##;"); + " z##;", a); msg(" :##########################: " - " :##z"); + " :##z", a); msg(" +#########################W# " - " M#W"); + " M#W", a); msg(" W################@n+*i;:,` " - " +##,"); + " +##,", a); msg(" :##################WMxz+, " - " ,##i"); + " ,##i", a); msg(" n#######################W.., " - " W##"); + " W##", a); msg(" +#########################WW@+. .:. " - " z#x"); + " z#x", a); msg(" `@#############################@@###: " - " *#W"); + " *#W", a); msg(" #################################Wz: " - " :#@"); + " :#@", a); msg(",@###############################i " - " .##"); + " .##", a); msg("n@@@@@@@#########################+ " - " `##"); + " `##", a); msg("` `.:.`.,:iii;;;;;;;;iii;;;:` `.`` " - " `nW"); + " `nW", a); } /// Get argt of command with id diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 09781f392a..c6fbd6bf1d 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -2664,7 +2664,7 @@ static void abandon_cmdline(void) if (msg_scrolled == 0) { compute_cmdrow(); } - msg(""); + msg("", 0); redraw_cmdline = true; } @@ -3400,7 +3400,7 @@ static void draw_cmdline(int start, int len) } } - msg_outtrans_len(arshape_buf, newlen); + msg_outtrans_len(arshape_buf, newlen, 0); } else { draw_cmdline_no_arabicshape: if (kv_size(ccline.last_colors.colors)) { @@ -3410,12 +3410,10 @@ draw_cmdline_no_arabicshape: continue; } const int chunk_start = MAX(chunk.start, start); - msg_outtrans_len_attr(ccline.cmdbuff + chunk_start, - chunk.end - chunk_start, - chunk.attr); + msg_outtrans_len(ccline.cmdbuff + chunk_start, chunk.end - chunk_start, chunk.attr); } } else { - msg_outtrans_len(ccline.cmdbuff + start, len); + msg_outtrans_len(ccline.cmdbuff + start, len, 0); } } } diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 7609eb12b4..cd88cf53ce 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -118,7 +118,7 @@ void filemess(buf_T *buf, char *name, char *s, int attr) msg_scroll = msg_scroll_save; msg_scrolled_ign = true; // may truncate the message to avoid a hit-return prompt - msg_outtrans_attr(msg_may_trunc(false, IObuff), attr); + msg_outtrans(msg_may_trunc(false, IObuff), attr); msg_clr_eos(); ui_flush(); msg_scrolled_ign = false; @@ -1762,7 +1762,7 @@ failed: if (msg_col > 0) { msg_putchar('\r'); // overwrite previous message } - p = (uint8_t *)msg_trunc_attr(IObuff, false, 0); + p = (uint8_t *)msg_trunc(IObuff, false, 0); } if (read_stdin || read_buffer || restart_edit != 0 @@ -2035,7 +2035,7 @@ static char *readfile_charconvert(char *fname, char *fenc, int *fdp) if (errmsg != NULL) { // Don't use emsg(), it breaks mappings, the retry with // another type of conversion might still work. - msg(errmsg); + msg(errmsg, 0); if (tmpname != NULL) { os_remove(tmpname); // delete converted file XFREE_CLEAR(tmpname); diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index eeed58a9ab..c097c6a524 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -1523,7 +1523,7 @@ static void highlight_list_one(const int id) didh = true; msg_puts_attr("links to", HL_ATTR(HLF_D)); msg_putchar(' '); - msg_outtrans(hl_table[hl_table[id - 1].sg_link - 1].sg_name); + msg_outtrans(hl_table[hl_table[id - 1].sg_link - 1].sg_name, 0); } if (!didh) { @@ -1656,7 +1656,7 @@ static bool highlight_list_arg(const int id, bool didh, const int type, int iarg msg_puts_attr(name, HL_ATTR(HLF_D)); msg_puts_attr("=", HL_ATTR(HLF_D)); } - msg_outtrans(ts); + msg_outtrans(ts, 0); } return didh; } @@ -1786,7 +1786,7 @@ bool syn_list_header(const bool did_header, const int outlen, const int id, bool if (got_int) { return true; } - msg_outtrans(hl_table[id - 1].sg_name); + msg_outtrans(hl_table[id - 1].sg_name, 0); name_col = msg_col; endcol = 15; } else if ((ui_has(kUIMessages) || msg_silent) && !force_newline) { diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c index d961d6664a..e1e1750e8e 100644 --- a/src/nvim/insexpand.c +++ b/src/nvim/insexpand.c @@ -467,9 +467,8 @@ bool check_compl_option(bool dict_opt) && *curbuf->b_p_tsrfu == NUL && *p_tsrfu == NUL)) { ctrl_x_mode = CTRL_X_NORMAL; edit_submode = NULL; - msg_attr((dict_opt - ? _("'dictionary' option is empty") - : _("'thesaurus' option is empty")), HL_ATTR(HLF_E)); + msg((dict_opt ? _("'dictionary' option is empty") : _("'thesaurus' option is empty")), + HL_ATTR(HLF_E)); if (emsg_silent == 0 && !in_assert_fails) { vim_beep(BO_COMPL); setcursor(); @@ -1452,10 +1451,10 @@ static void ins_compl_files(int count, char **files, int thesaurus, int flags, r for (i = 0; i < count && !got_int && !compl_interrupted; i++) { fp = os_fopen(files[i], "r"); // open dictionary file if (flags != DICT_EXACT && !shortmess(SHM_COMPLETIONSCAN)) { - msg_hist_off = true; // reset in msg_trunc_attr() + msg_hist_off = true; // reset in msg_trunc() vim_snprintf(IObuff, IOSIZE, _("Scanning dictionary: %s"), files[i]); - (void)msg_trunc_attr(IObuff, true, HL_ATTR(HLF_R)); + (void)msg_trunc(IObuff, true, HL_ATTR(HLF_R)); } if (fp == NULL) { @@ -2878,14 +2877,14 @@ static int process_next_cpt_value(ins_compl_next_state_T *st, int *compl_type_ar st->dict_f = DICT_EXACT; } if (!shortmess(SHM_COMPLETIONSCAN)) { - msg_hist_off = true; // reset in msg_trunc_attr() + msg_hist_off = true; // reset in msg_trunc() vim_snprintf(IObuff, IOSIZE, _("Scanning: %s"), st->ins_buf->b_fname == NULL ? buf_spname(st->ins_buf) : st->ins_buf->b_sfname == NULL ? st->ins_buf->b_fname : st->ins_buf->b_sfname); - (void)msg_trunc_attr(IObuff, true, HL_ATTR(HLF_R)); + (void)msg_trunc(IObuff, true, HL_ATTR(HLF_R)); } } else if (*st->e_cpt == NUL) { status = INS_COMPL_CPT_END; @@ -2909,9 +2908,9 @@ static int process_next_cpt_value(ins_compl_next_state_T *st, int *compl_type_ar } else if (*st->e_cpt == ']' || *st->e_cpt == 't') { compl_type = CTRL_X_TAGS; if (!shortmess(SHM_COMPLETIONSCAN)) { - msg_hist_off = true; // reset in msg_trunc_attr() + msg_hist_off = true; // reset in msg_trunc() vim_snprintf(IObuff, IOSIZE, "%s", _("Scanning tags.")); - (void)msg_trunc_attr(IObuff, true, HL_ATTR(HLF_R)); + (void)msg_trunc(IObuff, true, HL_ATTR(HLF_R)); } } @@ -3490,7 +3489,7 @@ static void ins_compl_show_filename(void) msg_hist_off = true; vim_snprintf(IObuff, IOSIZE, "%s %s%s", lead, s > compl_shown_match->cp_fname ? "<" : "", s); - msg(IObuff); + msg(IObuff, 0); msg_hist_off = false; redraw_cmdline = false; // don't overwrite! } @@ -4317,9 +4316,8 @@ static void ins_compl_show_statusmsg(void) if (edit_submode_extra != NULL) { if (!p_smd) { msg_hist_off = true; - msg_attr(edit_submode_extra, - (edit_submode_highl < HLF_COUNT - ? HL_ATTR(edit_submode_highl) : 0)); + msg(edit_submode_extra, (edit_submode_highl < HLF_COUNT + ? HL_ATTR(edit_submode_highl) : 0)); msg_hist_off = false; } } else { diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index f2efd866f8..32706b74f1 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -953,11 +953,11 @@ static void nlua_print_event(void **argv) } break; } - msg(str + start); + msg(str + start, 0); msg_didout = true; // Make blank lines work properly } if (len && str[len - 1] == NUL) { // Last was newline - msg(""); + msg("", 0); } xfree(str); } diff --git a/src/nvim/mapping.c b/src/nvim/mapping.c index 35a728314c..a19dbe78c5 100644 --- a/src/nvim/mapping.c +++ b/src/nvim/mapping.c @@ -877,9 +877,9 @@ static int buf_do_map(int maptype, MapArguments *args, int mode, bool is_abbrev, // print entries if (!did_it && !did_local) { if (is_abbrev) { - msg(_("No abbreviation found")); + msg(_("No abbreviation found"), 0); } else { - msg(_("No mapping found")); + msg(_("No mapping found"), 0); } } goto theend; // listing finished @@ -2504,7 +2504,7 @@ void ex_map(exarg_T *eap) // If we are in a secure mode we print the mappings for security reasons. if (secure) { secure = 2; - msg_outtrans(eap->cmd); + msg_outtrans(eap->cmd, 0); msg_putchar('\n'); } do_exmap(eap, false); diff --git a/src/nvim/mark.c b/src/nvim/mark.c index 0dc1be526b..20d60b44ec 100644 --- a/src/nvim/mark.c +++ b/src/nvim/mark.c @@ -881,7 +881,7 @@ static void show_one_mark(int c, char *arg, pos_T *p, char *name_arg, int curren did_title = false; } else { if (arg == NULL) { - msg(_("No marks set")); + msg(_("No marks set"), 0); } else { semsg(_("E283: No marks matching \"%s\""), arg); } @@ -903,9 +903,9 @@ static void show_one_mark(int c, char *arg, pos_T *p, char *name_arg, int curren msg_putchar('\n'); if (!got_int) { snprintf(IObuff, IOSIZE, " %c %6" PRIdLINENR " %4d ", c, p->lnum, p->col); - msg_outtrans(IObuff); + msg_outtrans(IObuff, 0); if (name != NULL) { - msg_outtrans_attr(name, current ? HL_ATTR(HLF_D) : 0); + msg_outtrans(name, current ? HL_ATTR(HLF_D) : 0); } } } @@ -1033,10 +1033,9 @@ void ex_jumps(exarg_T *eap) i == curwin->w_jumplistidx ? '>' : ' ', i > curwin->w_jumplistidx ? i - curwin->w_jumplistidx : curwin->w_jumplistidx - i, curwin->w_jumplist[i].fmark.mark.lnum, curwin->w_jumplist[i].fmark.mark.col); - msg_outtrans(IObuff); - msg_outtrans_attr(name, - curwin->w_jumplist[i].fmark.fnum == curbuf->b_fnum - ? HL_ATTR(HLF_D) : 0); + msg_outtrans(IObuff, 0); + msg_outtrans(name, + curwin->w_jumplist[i].fmark.fnum == curbuf->b_fnum ? HL_ATTR(HLF_D) : 0); xfree(name); os_breakcheck(); } @@ -1072,9 +1071,9 @@ void ex_changes(exarg_T *eap) i > curwin->w_changelistidx ? i - curwin->w_changelistidx : curwin->w_changelistidx - i, (long)curbuf->b_changelist[i].mark.lnum, curbuf->b_changelist[i].mark.col); - msg_outtrans(IObuff); + msg_outtrans(IObuff, 0); name = mark_line(&curbuf->b_changelist[i].mark, 17); - msg_outtrans_attr(name, HL_ATTR(HLF_D)); + msg_outtrans(name, HL_ATTR(HLF_D)); xfree(name); os_breakcheck(); } diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index 6182646fe7..3f035974a1 100644 --- a/src/nvim/mbyte.c +++ b/src/nvim/mbyte.c @@ -1527,7 +1527,7 @@ void show_utf8(void) char *line = get_cursor_pos_ptr(); int len = utfc_ptr2len(line); if (len == 0) { - msg("NUL"); + msg("NUL", 0); return; } @@ -1552,7 +1552,7 @@ void show_utf8(void) } } - msg(IObuff); + msg(IObuff, 0); } /// Return offset from "p" to the start of a character, including composing characters. diff --git a/src/nvim/memline.c b/src/nvim/memline.c index dc9173910e..7b83fe24b0 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -845,7 +845,7 @@ void ml_recover(bool checkext) if ((hp = mf_get(mfp, 0, 1)) == NULL) { msg_start(); msg_puts_attr(_("Unable to read block 0 from "), attr | MSG_HIST); - msg_outtrans_attr(mfp->mf_fname, attr | MSG_HIST); + msg_outtrans(mfp->mf_fname, attr | MSG_HIST); msg_puts_attr(_("\nMaybe no changes were made or Vim did not update the swap file."), attr | MSG_HIST); msg_end(); @@ -854,7 +854,7 @@ void ml_recover(bool checkext) b0p = hp->bh_data; if (strncmp(b0p->b0_version, "VIM 3.0", 7) == 0) { msg_start(); - msg_outtrans_attr(mfp->mf_fname, MSG_HIST); + msg_outtrans(mfp->mf_fname, MSG_HIST); msg_puts_attr(_(" cannot be used with this version of Vim.\n"), MSG_HIST); msg_puts_attr(_("Use Vim version 3.0.\n"), MSG_HIST); @@ -867,7 +867,7 @@ void ml_recover(bool checkext) } if (b0_magic_wrong(b0p)) { msg_start(); - msg_outtrans_attr(mfp->mf_fname, attr | MSG_HIST); + msg_outtrans(mfp->mf_fname, attr | MSG_HIST); msg_puts_attr(_(" cannot be used on this computer.\n"), attr | MSG_HIST); msg_puts_attr(_("The file was created on "), attr | MSG_HIST); @@ -887,7 +887,7 @@ void ml_recover(bool checkext) mf_new_page_size(mfp, (unsigned)char_to_long(b0p->b0_page_size)); if (mfp->mf_page_size < previous_page_size) { msg_start(); - msg_outtrans_attr(mfp->mf_fname, attr | MSG_HIST); + msg_outtrans(mfp->mf_fname, attr | MSG_HIST); msg_puts_attr(_(" has been damaged (page size is smaller than minimum value).\n"), attr | MSG_HIST); msg_end(); @@ -1196,18 +1196,18 @@ void ml_recover(bool checkext) emsg(_("E311: Recovery Interrupted")); } else if (error) { no_wait_return++; - msg(">>>>>>>>>>>>>"); + msg(">>>>>>>>>>>>>", 0); emsg(_("E312: Errors detected while recovering; look for lines starting with ???")); no_wait_return--; - msg(_("See \":help E312\" for more information.")); - msg(">>>>>>>>>>>>>"); + msg(_("See \":help E312\" for more information."), 0); + msg(">>>>>>>>>>>>>", 0); } else { if (curbuf->b_changed) { - msg(_("Recovery completed. You should check if everything is OK.")); + msg(_("Recovery completed. You should check if everything is OK."), 0); msg_puts(_("\n(You might want to write out this file under another name\n")); msg_puts(_("and run diff with the original file to check for changes)")); } else { - msg(_("Recovery completed. Buffer contents equals file contents.")); + msg(_("Recovery completed. Buffer contents equals file contents."), 0); } msg_puts(_("\nYou may want to delete the .swp file now.")); if (swapfile_process_running(b0p, fname_used)) { @@ -1283,7 +1283,7 @@ int recover_names(char *fname, bool do_list, list_T *ret_list, int nr, char **fn if (do_list) { // use msg() to start the scrolling properly - msg(_("Swap files found:")); + msg(_("Swap files found:"), 0); msg_putchar('\n'); } @@ -1515,7 +1515,7 @@ static time_t swapfile_info(char *fname) // print name of owner of the file if (os_get_uname((uv_uid_t)file_info.stat.st_uid, uname, B0_UNAME_SIZE) == OK) { msg_puts(_(" owned by: ")); - msg_outtrans(uname); + msg_outtrans(uname, 0); msg_puts(_(" dated: ")); } else { msg_puts(_(" dated: ")); @@ -1543,7 +1543,7 @@ static time_t swapfile_info(char *fname) if (b0.b0_fname[0] == NUL) { msg_puts(_("[No Name]")); } else { - msg_outtrans(b0.b0_fname); + msg_outtrans(b0.b0_fname, 0); } msg_puts(_("\n modified: ")); @@ -1551,7 +1551,7 @@ static time_t swapfile_info(char *fname) if (*(b0.b0_uname) != NUL) { msg_puts(_("\n user name: ")); - msg_outtrans(b0.b0_uname); + msg_outtrans(b0.b0_uname, 0); } if (*(b0.b0_hname) != NUL) { @@ -1560,7 +1560,7 @@ static time_t swapfile_info(char *fname) } else { msg_puts(_("\n host name: ")); } - msg_outtrans(b0.b0_hname); + msg_outtrans(b0.b0_hname, 0); } if (char_to_long(b0.b0_pid) != 0L) { @@ -1785,7 +1785,7 @@ theend: if (message) { if (status == OK) { - msg(_("File preserved")); + msg(_("File preserved"), 0); } else { emsg(_("E314: Preserve failed")); } @@ -3226,7 +3226,7 @@ static void attention_message(buf_T *buf, char *fname) msg_puts("\"\n"); const time_t swap_mtime = swapfile_info(fname); msg_puts(_("While opening file \"")); - msg_outtrans(buf->b_fname); + msg_outtrans(buf->b_fname, 0); msg_puts("\"\n"); FileInfo file_info; if (!os_fileinfo(buf->b_fname, &file_info)) { @@ -3248,10 +3248,10 @@ static void attention_message(buf_T *buf, char *fname) " Quit, or continue with caution.\n")); msg_puts(_("(2) An edit session for this file crashed.\n")); msg_puts(_(" If this is the case, use \":recover\" or \"vim -r ")); - msg_outtrans(buf->b_fname); + msg_outtrans(buf->b_fname, 0); msg_puts(_("\"\n to recover the changes (see \":help recovery\").\n")); msg_puts(_(" If you did this already, delete the swap file \"")); - msg_outtrans(fname); + msg_outtrans(fname, 0); msg_puts(_("\"\n to avoid this message.\n")); cmdline_row = msg_row; no_wait_return--; diff --git a/src/nvim/menu.c b/src/nvim/menu.c index 3b2e45e2a4..f51f2999a3 100644 --- a/src/nvim/menu.c +++ b/src/nvim/menu.c @@ -824,7 +824,7 @@ static void show_menus_recursive(vimmenu_T *menu, int modes, int depth) msg_puts(" "); } // Same highlighting as for directories!? - msg_outtrans_attr(menu->name, HL_ATTR(HLF_D)); + msg_outtrans(menu->name, HL_ATTR(HLF_D)); } if (menu != NULL && menu->children == NULL) { diff --git a/src/nvim/message.c b/src/nvim/message.c index dba4dba600..63d1b44d67 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -212,15 +212,6 @@ void msg_grid_validate(void) } } -/// Displays the string 's' on the status line -/// When terminal not initialized (yet) os_errmsg(..) is used. -/// -/// @return true if wait_return() not called -int msg(const char *s) -{ - return msg_attr_keep(s, 0, false, false); -} - /// Like msg() but keep it silent when 'verbosefile' is set. int verb_msg(const char *s) { @@ -231,14 +222,18 @@ int verb_msg(const char *s) return n; } -int msg_attr(const char *s, const int attr) +/// Displays the string 's' on the status line +/// When terminal not initialized (yet) os_errmsg(..) is used. +/// +/// @return true if wait_return() not called +int msg(const char *s, const int attr) FUNC_ATTR_NONNULL_ARG(1) { return msg_attr_keep(s, attr, false, false); } -/// Similar to msg_outtrans_attr, but support newlines and tabs. -void msg_multiline_attr(const char *s, int attr, bool check_int, bool *need_clear) +/// Similar to msg_outtrans, but support newlines and tabs. +void msg_multiline(const char *s, int attr, bool check_int, bool *need_clear) FUNC_ATTR_NONNULL_ALL { const char *next_spec = s; @@ -251,7 +246,7 @@ void msg_multiline_attr(const char *s, int attr, bool check_int, bool *need_clea if (next_spec != NULL) { // Printing all char that are before the char found by strpbrk - msg_outtrans_len_attr(s, (int)(next_spec - s), attr); + msg_outtrans_len(s, (int)(next_spec - s), attr); if (*next_spec != TAB && *need_clear) { msg_clr_eos(); @@ -265,7 +260,7 @@ void msg_multiline_attr(const char *s, int attr, bool check_int, bool *need_clea // Print the rest of the message. We know there is no special // character because strpbrk returned NULL if (*s != NUL) { - msg_outtrans_attr(s, attr); + msg_outtrans(s, attr); } } @@ -278,7 +273,7 @@ void msg_multiattr(HlMessage hl_msg, const char *kind, bool history) msg_ext_set_kind(kind); for (uint32_t i = 0; i < kv_size(hl_msg); i++) { HlMessageChunk chunk = kv_A(hl_msg, i); - msg_multiline_attr(chunk.text.data, chunk.attr, true, &need_clear); + msg_multiline(chunk.text.data, chunk.attr, true, &need_clear); } if (history && kv_size(hl_msg)) { add_msg_hist_multiattr(NULL, 0, 0, true, hl_msg); @@ -339,9 +334,9 @@ bool msg_attr_keep(const char *s, int attr, bool keep, bool multiline) bool need_clear = true; if (multiline) { - msg_multiline_attr(s, attr, false, &need_clear); + msg_multiline(s, attr, false, &need_clear); } else { - msg_outtrans_attr(s, attr); + msg_outtrans(s, attr); } if (need_clear) { msg_clr_eos(); @@ -491,7 +486,7 @@ int smsg(const char *s, ...) vim_vsnprintf(IObuff, IOSIZE, s, arglist); va_end(arglist); - return msg(IObuff); + return msg(IObuff, 0); } int smsg_attr(int attr, const char *s, ...) @@ -502,7 +497,7 @@ int smsg_attr(int attr, const char *s, ...) va_start(arglist, s); vim_vsnprintf(IObuff, IOSIZE, s, arglist); va_end(arglist); - return msg_attr(IObuff, attr); + return msg(IObuff, attr); } int smsg_attr_keep(int attr, const char *s, ...) @@ -604,12 +599,12 @@ void msg_source(int attr) char *p = get_emsg_source(); if (p != NULL) { msg_scroll = true; // this will take more than one line - msg_attr(p, attr); + msg(p, attr); xfree(p); } p = get_emsg_lnum(); if (p != NULL) { - msg_attr(p, HL_ATTR(HLF_N)); + msg(p, HL_ATTR(HLF_N)); xfree(p); last_sourcing_lnum = SOURCING_LNUM; // only once for each line } @@ -908,7 +903,7 @@ void msg_schedule_semsg_multiline(const char *const fmt, ...) /// Careful: The string may be changed by msg_may_trunc()! /// /// @return a pointer to the printed message, if wait_return() not called. -char *msg_trunc_attr(char *s, bool force, int attr) +char *msg_trunc(char *s, bool force, int attr) { int n; @@ -918,7 +913,7 @@ char *msg_trunc_attr(char *s, bool force, int attr) char *ts = msg_may_trunc(force, s); msg_hist_off = true; - n = msg_attr(ts, attr); + n = msg(ts, attr); msg_hist_off = false; if (n) { @@ -1400,7 +1395,7 @@ void msgmore(long n) if (got_int) { xstrlcat(msg_buf, _(" (Interrupted)"), MSG_BUF_LEN); } - if (msg(msg_buf)) { + if (msg(msg_buf, 0)) { set_keep_msg(msg_buf, 0); keep_msg_more = true; } @@ -1520,7 +1515,7 @@ void msg_home_replace_hl(const char *fname) static void msg_home_replace_attr(const char *fname, int attr) { char *name = home_replace_save(NULL, fname); - msg_outtrans_attr(name, attr); + msg_outtrans(name, attr); xfree(name); } @@ -1529,19 +1524,9 @@ static void msg_home_replace_attr(const char *fname, int attr) /// Use attributes 'attr'. /// /// @return the number of characters it takes on the screen. -int msg_outtrans(const char *str) -{ - return msg_outtrans_attr(str, 0); -} - -int msg_outtrans_attr(const char *str, int attr) -{ - return msg_outtrans_len_attr(str, (int)strlen(str), attr); -} - -int msg_outtrans_len(const char *str, int len) +int msg_outtrans(const char *str, int attr) { - return msg_outtrans_len_attr(str, len, 0); + return msg_outtrans_len(str, (int)strlen(str), attr); } /// Output one character at "p". @@ -1553,14 +1538,14 @@ const char *msg_outtrans_one(const char *p, int attr) int l; if ((l = utfc_ptr2len(p)) > 1) { - msg_outtrans_len_attr(p, l, attr); + msg_outtrans_len(p, l, attr); return p + l; } msg_puts_attr(transchar_byte_buf(NULL, (uint8_t)(*p)), attr); return p + 1; } -int msg_outtrans_len_attr(const char *msgstr, int len, int attr) +int msg_outtrans_len(const char *msgstr, int len, int attr) { int retval = 0; const char *str = msgstr; @@ -2052,10 +2037,10 @@ void msg_outtrans_long_len_attr(const char *longstr, int len, int attr) room = Columns - msg_col; if (len > room && room >= 20) { slen = (room - 3) / 2; - msg_outtrans_len_attr(longstr, slen, attr); + msg_outtrans_len(longstr, slen, attr); msg_puts_attr("...", HL_ATTR(HLF_8)); } - msg_outtrans_len_attr(longstr + len - slen, slen, attr); + msg_outtrans_len(longstr + len - slen, slen, attr); } /// Basic function for writing a message with highlight attributes. @@ -3467,7 +3452,7 @@ void give_warning(const char *message, bool hl) msg_ext_set_kind("wmsg"); } - if (msg_attr(message, keep_msg_attr) && msg_scrolled == 0) { + if (msg(message, keep_msg_attr) && msg_scrolled == 0) { set_keep_msg(message, keep_msg_attr); } msg_didout = false; // Overwrite this message. diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 309b6e2568..adb0aa8998 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -689,7 +689,7 @@ static void normal_redraw_mode_message(NormalState *s) keep_msg = kmsg; kmsg = xstrdup(keep_msg); - msg_attr(kmsg, keep_msg_attr); + msg(kmsg, keep_msg_attr); xfree(kmsg); } setcursor(); @@ -1377,7 +1377,7 @@ static void normal_redraw(NormalState *s) // check for duplicates. Never put this message in // history. msg_hist_off = true; - msg_attr(p, keep_msg_attr); + msg(p, keep_msg_attr); msg_hist_off = false; xfree(p); } @@ -6140,9 +6140,9 @@ static void nv_esc(cmdarg_T *cap) if (restart_edit == 0 && cmdwin_type == 0 && !VIsual_active && no_reason) { if (anyBufIsChanged()) { msg(_("Type :qa! and press <Enter> to abandon all changes" - " and exit Nvim")); + " and exit Nvim"), 0); } else { - msg(_("Type :qa and press <Enter> to exit Nvim")); + msg(_("Type :qa and press <Enter> to exit Nvim"), 0); } } diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 96deae228f..d328299232 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -938,7 +938,7 @@ int do_record(int c) if (p_ch == 0 || ui_has(kUIMessages)) { showmode(); } else { - msg(""); + msg("", 0); } if (p == NULL) { retval = FAIL; @@ -3838,7 +3838,7 @@ void ex_display(exarg_T *eap) for (p = yb->y_array[j]; *p != NUL && (n -= ptr2cells(p)) >= 0; p++) { // -V1019 clen = utfc_ptr2len(p); - msg_outtrans_len(p, clen); + msg_outtrans_len(p, clen, 0); p += clen - 1; } } @@ -3913,10 +3913,10 @@ static void dis_msg(const char *p, bool skip_esc) && (n -= ptr2cells(p)) >= 0) { int l; if ((l = utfc_ptr2len(p)) > 1) { - msg_outtrans_len(p, l); + msg_outtrans_len(p, l, 0); p += l; } else { - msg_outtrans_len(p++, 1); + msg_outtrans_len(p++, 1, 0); } } os_breakcheck(); @@ -5333,7 +5333,7 @@ void cursor_pos_info(dict_T *dict) // Compute the length of the file in characters. if (curbuf->b_ml.ml_flags & ML_EMPTY) { if (dict == NULL) { - msg(_(no_lines_msg)); + msg(_(no_lines_msg), 0); return; } } else { @@ -5538,7 +5538,7 @@ void cursor_pos_info(dict_T *dict) msg_start(); msg_scroll = true; } - msg(IObuff); + msg(IObuff, 0); p_shm = p; } } @@ -6452,7 +6452,7 @@ static yankreg_T *adjust_clipboard_name(int *name, bool quiet, bool writing) clipboard_didwarn = true; // Do NOT error (emsg()) here--if it interrupts :redir we get into // a weird state, stuck in "redirect mode". - msg(MSG_NO_CLIP); + msg(MSG_NO_CLIP, 0); } // ... else, be silent (don't flood during :while, :redir, etc.). goto end; diff --git a/src/nvim/option.c b/src/nvim/option.c index c34999ed32..bc8ced0e12 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -2476,7 +2476,7 @@ static const char *did_set_arabic(optset_T *args) static char *w_arabic = N_("W17: Arabic requires UTF-8, do ':set encoding=utf-8'"); msg_source(HL_ATTR(HLF_W)); - msg_attr(_(w_arabic), HL_ATTR(HLF_W)); + msg(_(w_arabic), HL_ATTR(HLF_W)); set_vim_var_string(VV_WARNINGMSG, _(w_arabic), -1); } @@ -4058,7 +4058,7 @@ static void showoneopt(vimoption_T *p, int opt_flags) msg_putchar('='); // put value string in NameBuff option_value2string(p, opt_flags); - msg_outtrans(NameBuff); + msg_outtrans(NameBuff, 0); } silent_mode = save_silent; diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c index 81e15bf841..1cd560c5ef 100644 --- a/src/nvim/os/shell.c +++ b/src/nvim/os/shell.c @@ -364,7 +364,7 @@ int os_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, in if (!(flags & EW_SILENT)) { msg_putchar('\n'); // clear bottom line quickly cmdline_row = Rows - 1; // continue on last line - msg(_(e_wildexpand)); + msg(_(e_wildexpand), 0); msg_start(); // don't overwrite this message } @@ -381,7 +381,7 @@ int os_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, in if (fd == NULL) { // Something went wrong, perhaps a file name with a special char. if (!(flags & EW_SILENT)) { - msg(_(e_wildexpand)); + msg(_(e_wildexpand), 0); msg_start(); // don't overwrite this message } xfree(tempname); @@ -876,9 +876,9 @@ static int do_os_system(char **argv, const char *input, size_t len, char **outpu // Failed, probably 'shell' is not executable. if (!silent) { msg_puts(_("\nshell failed to start: ")); - msg_outtrans(os_strerror(status)); + msg_outtrans(os_strerror(status), 0); msg_puts(": "); - msg_outtrans(prog); + msg_outtrans(prog, 0); msg_putchar('\n'); } multiqueue_free(events); @@ -1127,7 +1127,7 @@ static void out_data_append_to_screen(char *output, size_t *count, bool eof) goto end; } - (void)msg_outtrans_len_attr(p, i, 0); + (void)msg_outtrans_len(p, i, 0); p += i; } } diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 70fcf3d276..54d0262f90 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -3132,7 +3132,7 @@ static void qf_list_entry(qfline_T *qfp, int qf_idx, bool cursel) } msg_putchar('\n'); - msg_outtrans_attr(IObuff, cursel ? HL_ATTR(HLF_QFL) : qfFileAttr); + msg_outtrans(IObuff, cursel ? HL_ATTR(HLF_QFL) : qfFileAttr); if (qfp->qf_lnum != 0) { msg_puts_attr(":", qfSepAttr); @@ -3308,7 +3308,7 @@ static void qf_msg(qf_info_T *qi, int which, char *lead) xstrlcat(buf, title, IOSIZE); } trunc_string(buf, buf, Columns - 1, IOSIZE); - msg(buf); + msg(buf, 0); } /// ":colder [count]": Up in the quickfix stack. @@ -3367,7 +3367,7 @@ void qf_history(exarg_T *eap) } if (qf_stack_empty(qi)) { - msg(_("No entries")); + msg(_("No entries"), 0); } else { for (int i = 0; i < qi->qf_listcount; i++) { qf_msg(qi, i, i == qi->qf_curlist ? "> " : " "); @@ -4317,7 +4317,7 @@ static char *make_get_fullcmd(const char *makecmd, const char *fname) } msg_start(); msg_puts(":!"); - msg_outtrans(cmd); // show what we are doing + msg_outtrans(cmd, 0); // show what we are doing return cmd; } @@ -5168,9 +5168,9 @@ static void vgr_display_fname(char *fname) msg_start(); char *p = msg_strtrunc(fname, true); if (p == NULL) { - msg_outtrans(fname); + msg_outtrans(fname, 0); } else { - msg_outtrans(p); + msg_outtrans(p, 0); xfree(p); } msg_clr_eos(); diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c index 269c3805a1..4cb5925176 100644 --- a/src/nvim/runtime.c +++ b/src/nvim/runtime.c @@ -2329,7 +2329,7 @@ void ex_scriptnames(exarg_T *eap) vim_snprintf(IObuff, IOSIZE, "%3d: %s", i, NameBuff); if (!message_filtered(IObuff)) { msg_putchar('\n'); - msg_outtrans(IObuff); + msg_outtrans(IObuff, 0); line_breakcheck(); } } diff --git a/src/nvim/search.c b/src/nvim/search.c index cb6596d211..e9b92ce3f4 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -1263,7 +1263,7 @@ int do_search(oparg_T *oap, int dirc, int search_delim, char *pat, int count, in memset(msgbuf + pat_len, ' ', (size_t)(r - msgbuf)); } } - msg_outtrans(msgbuf); + msg_outtrans(msgbuf, 0); msg_clr_eos(); msg_check(); @@ -3709,7 +3709,7 @@ void find_pattern_in_path(char *ptr, Direction dir, size_t len, bool whole, bool if (new_fname != NULL) { // using "new_fname" is more reliable, e.g., when // 'includeexpr' is set. - msg_outtrans_attr(new_fname, HL_ATTR(HLF_D)); + msg_outtrans(new_fname, HL_ATTR(HLF_D)); } else { // Isolate the file name. // Include the surrounding "" or <> if present. @@ -3743,7 +3743,7 @@ void find_pattern_in_path(char *ptr, Direction dir, size_t len, bool whole, bool } save_char = p[i]; p[i] = NUL; - msg_outtrans_attr(p, HL_ATTR(HLF_D)); + msg_outtrans(p, HL_ATTR(HLF_D)); p[i] = save_char; } @@ -3791,11 +3791,11 @@ void find_pattern_in_path(char *ptr, Direction dir, size_t len, bool whole, bool files[depth].lnum = 0; files[depth].matched = false; if (action == ACTION_EXPAND) { - msg_hist_off = true; // reset in msg_trunc_attr() + msg_hist_off = true; // reset in msg_trunc() vim_snprintf(IObuff, IOSIZE, _("Scanning included file: %s"), new_fname); - msg_trunc_attr(IObuff, true, HL_ATTR(HLF_R)); + msg_trunc(IObuff, true, HL_ATTR(HLF_R)); } else if (p_verbose >= 5) { verbose_enter(); smsg(_("Searching included file %s"), new_fname); @@ -4116,9 +4116,9 @@ exit_matched: if (type == CHECK_PATH) { if (!did_show) { if (action != ACTION_SHOW_ALL) { - msg(_("All included files were found")); + msg(_("All included files were found"), 0); } else { - msg(_("No included files")); + msg(_("No included files"), 0); } } } else if (!found diff --git a/src/nvim/sign.c b/src/nvim/sign.c index 1910e046e6..e30dffa294 100644 --- a/src/nvim/sign.c +++ b/src/nvim/sign.c @@ -1663,12 +1663,12 @@ static void sign_list_defined(sign_T *sp) smsg("sign %s", sp->sn_name); if (sp->sn_icon != NULL) { msg_puts(" icon="); - msg_outtrans(sp->sn_icon); + msg_outtrans(sp->sn_icon, 0); msg_puts(_(" (not supported)")); } if (sp->sn_text != NULL) { msg_puts(" text="); - msg_outtrans(sp->sn_text); + msg_outtrans(sp->sn_text, 0); } if (sp->sn_line_hl > 0) { msg_puts(" linehl="); diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c index d7dc7fb672..379342df03 100644 --- a/src/nvim/spellfile.c +++ b/src/nvim/spellfile.c @@ -1955,9 +1955,9 @@ static void spell_print_node(wordnode_T *node, int depth) PRINTSOME(line1, depth, "(%d)", node->wn_nr, 0); PRINTSOME(line2, depth, " ", 0, 0); PRINTSOME(line3, depth, " ", 0, 0); - msg(line1); - msg(line2); - msg(line3); + msg(line1, 0); + msg(line2, 0); + msg(line3, 0); } else { node->wn_u1.index = true; @@ -1981,9 +1981,9 @@ static void spell_print_node(wordnode_T *node, int depth) } if (node->wn_byte == NUL) { - msg(line1); - msg(line2); - msg(line3); + msg(line1, 0); + msg(line2, 0); + msg(line3, 0); } // do the children @@ -2726,11 +2726,11 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname) // Check that we didn't use too many renumbered flags. if (spin->si_newcompID < spin->si_newprefID) { if (spin->si_newcompID == 127 || spin->si_newcompID == 255) { - msg(_("Too many postponed prefixes")); + msg(_("Too many postponed prefixes"), 0); } else if (spin->si_newprefID == 0 || spin->si_newprefID == 127) { - msg(_("Too many compound flags")); + msg(_("Too many compound flags"), 0); } else { - msg(_("Too many postponed prefixes and/or compound flags")); + msg(_("Too many postponed prefixes and/or compound flags"), 0); } } @@ -5398,7 +5398,7 @@ static void mkspell(int fcount, char **fnames, bool ascii, bool over_write, bool } if (spin.si_compflags != NULL && spin.si_nobreak) { - msg(_("Warning: both compounding and NOBREAK specified")); + msg(_("Warning: both compounding and NOBREAK specified"), 0); } if (!error && !got_int) { @@ -5468,7 +5468,7 @@ static void spell_message(const spellinfo_T *spin, char *str) if (!spin->si_verbose) { verbose_enter(); } - msg(str); + msg(str, 0); ui_flush(); if (!spin->si_verbose) { verbose_leave(); diff --git a/src/nvim/spellsuggest.c b/src/nvim/spellsuggest.c index ba389cc070..4c1873eaca 100644 --- a/src/nvim/spellsuggest.c +++ b/src/nvim/spellsuggest.c @@ -526,7 +526,7 @@ void spell_suggest(int count) true, need_cap, true); if (GA_EMPTY(&sug.su_ga)) { - msg(_("Sorry, no suggestions")); + msg(_("Sorry, no suggestions"), 0); } else if (count > 0) { if (count > sug.su_ga.ga_len) { smsg(_("Sorry, only %" PRId64 " suggestions"), diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 7e3ae4a62c..10f808ad6b 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -2713,7 +2713,7 @@ static int syn_regexec(regmmatch_T *rmp, linenr_T lnum, colnr_T col, syn_time_T } if (timed_out && !syn_win->w_s->b_syn_slow) { syn_win->w_s->b_syn_slow = true; - msg(_("'redrawtime' exceeded, syntax highlighting disabled")); + msg(_("'redrawtime' exceeded, syntax highlighting disabled"), 0); } if (r > 0) { @@ -2816,9 +2816,9 @@ static void syn_cmd_conceal(exarg_T *eap, int syncing) next = skiptowhite(arg); if (*arg == NUL) { if (curwin->w_s->b_syn_conceal) { - msg("syntax conceal on"); + msg("syntax conceal on", 0); } else { - msg("syntax conceal off"); + msg("syntax conceal off", 0); } } else if (STRNICMP(arg, "on", 2) == 0 && next - arg == 2) { curwin->w_s->b_syn_conceal = true; @@ -2843,9 +2843,9 @@ static void syn_cmd_case(exarg_T *eap, int syncing) next = skiptowhite(arg); if (*arg == NUL) { if (curwin->w_s->b_syn_ic) { - msg("syntax case ignore"); + msg("syntax case ignore", 0); } else { - msg("syntax case match"); + msg("syntax case match", 0); } } else if (STRNICMP(arg, "match", 5) == 0 && next - arg == 5) { curwin->w_s->b_syn_ic = false; @@ -2870,9 +2870,9 @@ static void syn_cmd_foldlevel(exarg_T *eap, int syncing) if (*arg == NUL) { switch (curwin->w_s->b_syn_foldlevel) { case SYNFLD_START: - msg("syntax foldlevel start"); break; + msg("syntax foldlevel start", 0); break; case SYNFLD_MINIMUM: - msg("syntax foldlevel minimum"); break; + msg("syntax foldlevel minimum", 0); break; default: break; } @@ -2909,11 +2909,11 @@ static void syn_cmd_spell(exarg_T *eap, int syncing) next = skiptowhite(arg); if (*arg == NUL) { if (curwin->w_s->b_syn_spell == SYNSPL_TOP) { - msg("syntax spell toplevel"); + msg("syntax spell toplevel", 0); } else if (curwin->w_s->b_syn_spell == SYNSPL_NOTOP) { - msg("syntax spell notoplevel"); + msg("syntax spell notoplevel", 0); } else { - msg("syntax spell default"); + msg("syntax spell default", 0); } } else if (STRNICMP(arg, "toplevel", 8) == 0 && next - arg == 8) { curwin->w_s->b_syn_spell = SYNSPL_TOP; @@ -2946,9 +2946,9 @@ static void syn_cmd_iskeyword(exarg_T *eap, int syncing) msg_puts("\n"); if (curwin->w_s->b_syn_isk != empty_option) { msg_puts("syntax iskeyword "); - msg_outtrans(curwin->w_s->b_syn_isk); + msg_outtrans(curwin->w_s->b_syn_isk, 0); } else { - msg_outtrans(_("syntax iskeyword not set")); + msg_outtrans(_("syntax iskeyword not set"), 0); } } else { if (STRNICMP(arg, "clear", 5) == 0) { @@ -3235,7 +3235,7 @@ static void syn_cmd_list(exarg_T *eap, int syncing) } if (!syntax_present(curwin)) { - msg(_(msg_no_items)); + msg(_(msg_no_items), 0); return; } @@ -3427,7 +3427,7 @@ static void syn_list_one(const int id, const bool syncing, const bool link_only) msg_putchar(' '); if (spp->sp_sync_idx >= 0) { msg_outtrans(highlight_group_name(SYN_ITEMS(curwin->w_s) - [spp->sp_sync_idx].sp_syn.id - 1)); + [spp->sp_sync_idx].sp_syn.id - 1), 0); } else { msg_puts("NONE"); } @@ -3440,7 +3440,7 @@ static void syn_list_one(const int id, const bool syncing, const bool link_only) (void)syn_list_header(did_header, 0, id, true); msg_puts_attr("links to", attr); msg_putchar(' '); - msg_outtrans(highlight_group_name(highlight_link_id(id - 1) - 1)); + msg_outtrans(highlight_group_name(highlight_link_id(id - 1) - 1), 0); } } @@ -3461,7 +3461,7 @@ static void syn_list_cluster(int id) // slight hack: roughly duplicate the guts of syn_list_header() msg_putchar('\n'); - msg_outtrans(SYN_CLSTR(curwin->w_s)[id].scl_name); + msg_outtrans(SYN_CLSTR(curwin->w_s)[id].scl_name, 0); if (msg_col >= endcol) { // output at least one space endcol = msg_col + 1; @@ -3498,9 +3498,9 @@ static void put_id_list(const char *const name, const int16_t *const list, const int scl_id = *p - SYNID_CLUSTER; msg_putchar('@'); - msg_outtrans(SYN_CLSTR(curwin->w_s)[scl_id].scl_name); + msg_outtrans(SYN_CLSTR(curwin->w_s)[scl_id].scl_name, 0); } else { - msg_outtrans(highlight_group_name(*p - 1)); + msg_outtrans(highlight_group_name(*p - 1), 0); } if (p[1]) { msg_putchar(','); @@ -3520,9 +3520,9 @@ static void put_pattern(const char *const s, const int c, const synpat_T *const msg_puts_attr("matchgroup", attr); msg_putchar('='); if (last_matchgroup == 0) { - msg_outtrans("NONE"); + msg_outtrans("NONE", 0); } else { - msg_outtrans(highlight_group_name(last_matchgroup - 1)); + msg_outtrans(highlight_group_name(last_matchgroup - 1), 0); } msg_putchar(' '); } @@ -3539,7 +3539,7 @@ static void put_pattern(const char *const s, const int c, const synpat_T *const } } msg_putchar(sepchars[i]); - msg_outtrans(spp->sp_pattern); + msg_outtrans(spp->sp_pattern, 0); msg_putchar(sepchars[i]); // output any pattern options @@ -3649,7 +3649,7 @@ static bool syn_list_keywords(const int id, const hashtab_T *const ht, bool did_ prev_skipempty = (kp->flags & HL_SKIPEMPTY); } } - msg_outtrans(kp->keyword); + msg_outtrans(kp->keyword, 0); } } } @@ -5590,7 +5590,7 @@ static void syntime_clear(void) synpat_T *spp; if (!syntax_present(curwin)) { - msg(_(msg_no_items)); + msg(_(msg_no_items), 0); return; } for (int idx = 0; idx < curwin->w_s->b_syn_patterns.ga_len; idx++) { @@ -5628,7 +5628,7 @@ static int syn_compare_syntime(const void *v1, const void *v2) static void syntime_report(void) { if (!syntax_present(curwin)) { - msg(_(msg_no_items)); + msg(_(msg_no_items), 0); return; } @@ -5682,7 +5682,7 @@ static void syntime_report(void) msg_puts(profile_msg(p->average)); msg_puts(" "); msg_advance(50); - msg_outtrans(highlight_group_name(p->id - 1)); + msg_outtrans(highlight_group_name(p->id - 1), 0); msg_puts(" "); msg_advance(69); @@ -5695,7 +5695,7 @@ static void syntime_report(void) if (len > (int)strlen(p->pattern)) { len = (int)strlen(p->pattern); } - msg_outtrans_len(p->pattern, len); + msg_outtrans_len(p->pattern, len, 0); msg_puts("\n"); } ga_clear(&ga); diff --git a/src/nvim/tag.c b/src/nvim/tag.c index 8bbfb663bd..c21b3a850b 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -736,11 +736,7 @@ void do_tag(char *tag, int type, int count, int forceit, int verbose) } if ((num_matches > prev_num_matches || new_tag) && num_matches > 1) { - if (ic) { - msg_attr(IObuff, HL_ATTR(HLF_W)); - } else { - msg(IObuff); - } + msg(IObuff, ic ? HL_ATTR(HLF_W) : 0); msg_scroll = true; // Don't overwrite this message. } else { give_warning(IObuff, ic); @@ -847,13 +843,10 @@ static void print_tag_list(int new_tag, int use_tagstack, int num_matches, char mt_names[matches[i][0] & MT_MASK]); msg_puts(IObuff); if (tagp.tagkind != NULL) { - msg_outtrans_len(tagp.tagkind, - (int)(tagp.tagkind_end - tagp.tagkind)); + msg_outtrans_len(tagp.tagkind, (int)(tagp.tagkind_end - tagp.tagkind), 0); } msg_advance(13); - msg_outtrans_len_attr(tagp.tagname, - (int)(tagp.tagname_end - tagp.tagname), - HL_ATTR(HLF_T)); + msg_outtrans_len(tagp.tagname, (int)(tagp.tagname_end - tagp.tagname), HL_ATTR(HLF_T)); msg_putchar(' '); taglen_advance(taglen); @@ -861,7 +854,7 @@ static void print_tag_list(int new_tag, int use_tagstack, int num_matches, char // it and put "..." in the middle p = tag_full_fname(&tagp); if (p != NULL) { - msg_outtrans_attr(p, HL_ATTR(HLF_D)); + msg_outtrans(p, HL_ATTR(HLF_D)); XFREE_CLEAR(p); } if (msg_col > 0) { @@ -1149,9 +1142,8 @@ void do_tags(exarg_T *eap) tagstack[i].cur_match + 1, tagstack[i].tagname, tagstack[i].fmark.mark.lnum); - msg_outtrans(IObuff); - msg_outtrans_attr(name, tagstack[i].fmark.fnum == curbuf->b_fnum - ? HL_ATTR(HLF_D) : 0); + msg_outtrans(IObuff, 0); + msg_outtrans(name, tagstack[i].fmark.fnum == curbuf->b_fnum ? HL_ATTR(HLF_D) : 0); xfree(name); } } @@ -3019,7 +3011,7 @@ static int jumpto_tag(const char *lbuf_arg, int forceit, int keep_help) // Only give a message when really guessed, not when 'ic' // is set and match found while ignoring case. if (found == 2 || !save_p_ic) { - msg(_("E435: Couldn't find tag, just guessing!")); + msg(_("E435: Couldn't find tag, just guessing!"), 0); if (!msg_scrolled && msg_silent == 0) { ui_flush(); os_delay(1010L, true); diff --git a/src/nvim/ui.c b/src/nvim/ui.c index ba16ba545f..b0d4a58b82 100644 --- a/src/nvim/ui.c +++ b/src/nvim/ui.c @@ -332,7 +332,7 @@ void vim_beep(unsigned val) // comes from. if (vim_strchr(p_debug, 'e') != NULL) { msg_source(HL_ATTR(HLF_W)); - msg_attr(_("Beep!"), HL_ATTR(HLF_W)); + msg(_("Beep!"), HL_ATTR(HLF_W)); } } diff --git a/src/nvim/undo.c b/src/nvim/undo.c index 1194eeca35..598bfbc134 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -1883,7 +1883,7 @@ static void u_doit(int startcount, bool quiet, bool do_buf_event) curbuf->b_u_curhead = curbuf->b_u_oldhead; beep_flush(); if (count == startcount - 1) { - msg(_("Already at oldest change")); + msg(_("Already at oldest change"), 0); return; } break; @@ -1894,7 +1894,7 @@ static void u_doit(int startcount, bool quiet, bool do_buf_event) if (curbuf->b_u_curhead == NULL || get_undolevel(curbuf) <= 0) { beep_flush(); // nothing to redo if (count == startcount - 1) { - msg(_("Already at newest change")); + msg(_("Already at newest change"), 0); return; } break; @@ -2118,9 +2118,9 @@ void undo_time(long step, bool sec, bool file, bool absolute) if (closest == closest_start) { if (step < 0) { - msg(_("Already at oldest change")); + msg(_("Already at oldest change"), 0); } else { - msg(_("Already at newest change")); + msg(_("Already at newest change"), 0); } return; } @@ -2719,7 +2719,7 @@ void ex_undolist(exarg_T *eap) } if (GA_EMPTY(&ga)) { - msg(_("Nothing to undo")); + msg(_("Nothing to undo"), 0); } else { sort_strings(ga.ga_data, ga.ga_len); diff --git a/src/nvim/usercmd.c b/src/nvim/usercmd.c index 7ccd13c3a7..8672aa88f7 100644 --- a/src/nvim/usercmd.c +++ b/src/nvim/usercmd.c @@ -495,7 +495,7 @@ static void uc_list(char *name, size_t name_len) msg_putchar(' '); } - msg_outtrans_attr(cmd->uc_name, HL_ATTR(HLF_D)); + msg_outtrans(cmd->uc_name, HL_ATTR(HLF_D)); len = strlen(cmd->uc_name) + 4; do { @@ -582,7 +582,7 @@ static void uc_list(char *name, size_t name_len) } while ((int64_t)len < 25 - over); IObuff[len] = '\0'; - msg_outtrans(IObuff); + msg_outtrans(IObuff, 0); if (cmd->uc_luaref != LUA_NOREF) { char *fn = nlua_funcref_str(cmd->uc_luaref); @@ -611,7 +611,7 @@ static void uc_list(char *name, size_t name_len) } if (!found) { - msg(_("No user-defined commands found")); + msg(_("No user-defined commands found"), 0); } } diff --git a/src/nvim/version.c b/src/nvim/version.c index 0744a601bb..437434f92a 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -2691,19 +2691,19 @@ void list_lua_version(void) Object ret = nlua_exec(cstr_as_string(code), (Array)ARRAY_DICT_INIT, &err); assert(!ERROR_SET(&err)); assert(ret.type == kObjectTypeString); - msg(ret.data.string.data); + msg(ret.data.string.data, 0); api_free_object(ret); } void list_version(void) { - msg(longVersion); - msg(version_buildtype); + msg(longVersion, 0); + msg(version_buildtype, 0); list_lua_version(); if (p_verbose > 0) { #ifndef NDEBUG - msg(version_cflags); + msg(version_cflags, 0); #endif version_msg("\n\n"); diff --git a/src/nvim/window.c b/src/nvim/window.c index 1208494eaf..dbbbd9f87e 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -380,7 +380,7 @@ newwindow: case 'T': CHECK_CMDWIN; if (one_window(curwin)) { - msg(_(m_onlyone)); + msg(_(m_onlyone), 0); } else { tabpage_T *oldtab = curtab; @@ -3972,7 +3972,7 @@ void close_others(int message, int forceit) if (one_nonfloat() && !lastwin->w_floating) { if (message && !autocmd_busy) { - msg(_(m_onlyone)); + msg(_(m_onlyone), 0); } return; } |