diff options
author | bfredl <bjorn.linse@gmail.com> | 2023-09-27 22:21:17 +0200 |
---|---|---|
committer | bfredl <bjorn.linse@gmail.com> | 2023-09-27 22:50:49 +0200 |
commit | b85f1dafc7c0a19704135617454f1c66f41202c1 (patch) | |
tree | ce478ebdce2efaac4ff9f16e86bce556e2ef1e7d | |
parent | f91cd31d7d9d70006e0000592637d5d997eab52c (diff) | |
download | rneovim-b85f1dafc7c0a19704135617454f1c66f41202c1.tar.gz rneovim-b85f1dafc7c0a19704135617454f1c66f41202c1.tar.bz2 rneovim-b85f1dafc7c0a19704135617454f1c66f41202c1.zip |
refactor(messages): fold msg_attr into msg
problem: there are too many different functions in message.c
solution: fold some of the functions into themselves
35 files changed, 275 insertions, 289 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/buffer.c b/src/nvim/buffer.c index f04a3be447..1ef1f26d6b 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -3230,7 +3230,7 @@ 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); diff --git a/src/nvim/bufwrite.c b/src/nvim/bufwrite.c index 2f13586dcc..f2f6833db5 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(); } diff --git a/src/nvim/cmdhist.c b/src/nvim/cmdhist.c index 96d2710001..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; } 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/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..dc07c0fc90 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -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 60cf0f8054..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 diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 6a5e8a8d38..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. @@ -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; } 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 cbb0ae81c5..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; } @@ -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 4ec6d24d94..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; } diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 8a5473acdb..dfa61e7cf7 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -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/insexpand.c b/src/nvim/insexpand.c index d961d6664a..80118e9e11 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(); @@ -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 f2aeedd430..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 diff --git a/src/nvim/mark.c b/src/nvim/mark.c index 23555ba145..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); } 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 f8f148fa23..7b83fe24b0 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -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'); } @@ -1785,7 +1785,7 @@ theend: if (message) { if (status == OK) { - msg(_("File preserved")); + msg(_("File preserved"), 0); } else { emsg(_("E314: Preserve failed")); } diff --git a/src/nvim/message.c b/src/nvim/message.c index 4c19c0dd5b..a9d5fb332b 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,7 +222,11 @@ 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); @@ -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 } @@ -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; } @@ -3457,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 bab1696cfe..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; @@ -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 804adfe537..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); } diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c index 48219f6231..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); diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 39cb974e95..54d0262f90 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -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 ? "> " : " "); diff --git a/src/nvim/search.c b/src/nvim/search.c index 7e8737f6fb..bf6e60026a 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -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/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 f4e0fa7fd0..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; @@ -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; } @@ -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; } diff --git a/src/nvim/tag.c b/src/nvim/tag.c index f74556d45b..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); @@ -3015,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 f581151f63..8672aa88f7 100644 --- a/src/nvim/usercmd.c +++ b/src/nvim/usercmd.c @@ -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; } |