diff options
| author | bfredl <bjorn.linse@gmail.com> | 2023-09-29 16:10:54 +0200 |
|---|---|---|
| committer | bfredl <bjorn.linse@gmail.com> | 2023-09-29 16:36:04 +0200 |
| commit | bc13bc154aa574e0bb58a50f2e0ca4570efa57c3 (patch) | |
| tree | 86c6a0d607ec80d404c10bdbb377ad3fc8ce2ee4 /src | |
| parent | 8e11c18d4962c5367a0549bdb2288323545852b6 (diff) | |
| download | rneovim-bc13bc154aa574e0bb58a50f2e0ca4570efa57c3.tar.gz rneovim-bc13bc154aa574e0bb58a50f2e0ca4570efa57c3.tar.bz2 rneovim-bc13bc154aa574e0bb58a50f2e0ca4570efa57c3.zip | |
refactor(message): smsg_attr -> smsg
Diffstat (limited to 'src')
| -rw-r--r-- | src/nvim/autocmd.c | 8 | ||||
| -rw-r--r-- | src/nvim/buffer.c | 6 | ||||
| -rw-r--r-- | src/nvim/debugger.c | 24 | ||||
| -rw-r--r-- | src/nvim/diff.c | 2 | ||||
| -rw-r--r-- | src/nvim/eval.c | 2 | ||||
| -rw-r--r-- | src/nvim/eval/userfunc.c | 10 | ||||
| -rw-r--r-- | src/nvim/ex_cmds.c | 12 | ||||
| -rw-r--r-- | src/nvim/ex_docmd.c | 10 | ||||
| -rw-r--r-- | src/nvim/ex_eval.c | 8 | ||||
| -rw-r--r-- | src/nvim/file_search.c | 12 | ||||
| -rw-r--r-- | src/nvim/fileio.c | 2 | ||||
| -rw-r--r-- | src/nvim/help.c | 2 | ||||
| -rw-r--r-- | src/nvim/input.c | 2 | ||||
| -rw-r--r-- | src/nvim/lua/secure.c | 6 | ||||
| -rw-r--r-- | src/nvim/memline.c | 4 | ||||
| -rw-r--r-- | src/nvim/message.c | 18 | ||||
| -rw-r--r-- | src/nvim/ops.c | 20 | ||||
| -rw-r--r-- | src/nvim/os/fs.c | 2 | ||||
| -rw-r--r-- | src/nvim/os/lang.c | 2 | ||||
| -rw-r--r-- | src/nvim/os/shell.c | 2 | ||||
| -rw-r--r-- | src/nvim/quickfix.c | 2 | ||||
| -rw-r--r-- | src/nvim/regexp.c | 2 | ||||
| -rw-r--r-- | src/nvim/runtime.c | 28 | ||||
| -rw-r--r-- | src/nvim/search.c | 2 | ||||
| -rw-r--r-- | src/nvim/shada.c | 4 | ||||
| -rw-r--r-- | src/nvim/sign.c | 2 | ||||
| -rw-r--r-- | src/nvim/spell.c | 4 | ||||
| -rw-r--r-- | src/nvim/spellfile.c | 109 | ||||
| -rw-r--r-- | src/nvim/spellsuggest.c | 6 | ||||
| -rw-r--r-- | src/nvim/tag.c | 6 | ||||
| -rw-r--r-- | src/nvim/undo.c | 20 |
31 files changed, 161 insertions, 178 deletions
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c index f2408a9457..8c2df6f3b5 100644 --- a/src/nvim/autocmd.c +++ b/src/nvim/autocmd.c @@ -372,7 +372,7 @@ void aubuflocal_remove(buf_T *buf) if (p_verbose >= 6) { verbose_enter(); - smsg(_("auto-removing autocommand: %s <buffer=%d>"), event_nr2name(event), buf->b_fnum); + smsg(0, _("auto-removing autocommand: %s <buffer=%d>"), event_nr2name(event), buf->b_fnum); verbose_leave(); } } @@ -1150,7 +1150,7 @@ int do_doautocmd(char *arg_start, bool do_msg, bool *did_something) } if (nothing_done && do_msg && !aborting()) { - smsg(_("No matching autocommands: %s"), arg_start); + smsg(0, _("No matching autocommands: %s"), arg_start); } if (did_something != NULL) { *did_something = !nothing_done; @@ -1946,7 +1946,7 @@ static void aucmd_next(AutoPatCmd *apc) snprintf(namep, sourcing_name_len, s, name, ap->pat); if (p_verbose >= 8) { verbose_enter(); - smsg(_("Executing %s"), namep); + smsg(0, _("Executing %s"), namep); verbose_leave(); } @@ -2045,7 +2045,7 @@ char *getnextac(int c, void *cookie, int indent, bool do_concat) if (p_verbose >= 9) { verbose_enter_scroll(); char *exec_to_string = aucmd_exec_to_string(ac, ac->exec); - smsg(_("autocommand %s"), exec_to_string); + smsg(0, _("autocommand %s"), exec_to_string); msg_puts("\n"); // don't overwrite this either XFREE_CLEAR(exec_to_string); verbose_leave_scroll(); diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 2131f4d836..d6cab233d2 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -1106,13 +1106,13 @@ char *do_bufdel(int command, char *arg, int addr_count, int start_bnr, int end_b errormsg = IObuff; } else if (deleted >= p_report) { if (command == DOBUF_UNLOAD) { - smsg(NGETTEXT("%d buffer unloaded", "%d buffers unloaded", deleted), + smsg(0, NGETTEXT("%d buffer unloaded", "%d buffers unloaded", deleted), deleted); } else if (command == DOBUF_DEL) { - smsg(NGETTEXT("%d buffer deleted", "%d buffers deleted", deleted), + smsg(0, NGETTEXT("%d buffer deleted", "%d buffers deleted", deleted), deleted); } else { - smsg(NGETTEXT("%d buffer wiped out", "%d buffers wiped out", deleted), + smsg(0, NGETTEXT("%d buffer wiped out", "%d buffers wiped out", deleted), deleted); } } diff --git a/src/nvim/debugger.c b/src/nvim/debugger.c index 86ad70196d..ea6fd3bcb4 100644 --- a/src/nvim/debugger.c +++ b/src/nvim/debugger.c @@ -105,12 +105,12 @@ void do_debug(char *cmd) msg(_("Entering Debug mode. Type \"cont\" to continue."), 0); } if (debug_oldval != NULL) { - smsg(_("Oldval = \"%s\""), debug_oldval); + smsg(0, _("Oldval = \"%s\""), debug_oldval); xfree(debug_oldval); debug_oldval = NULL; } if (debug_newval != NULL) { - smsg(_("Newval = \"%s\""), debug_newval); + smsg(0, _("Newval = \"%s\""), debug_newval); xfree(debug_newval); debug_newval = NULL; } @@ -120,9 +120,9 @@ void do_debug(char *cmd) } xfree(sname); if (SOURCING_LNUM != 0) { - smsg(_("line %" PRId64 ": %s"), (int64_t)SOURCING_LNUM, cmd); + smsg(0, _("line %" PRId64 ": %s"), (int64_t)SOURCING_LNUM, cmd); } else { - smsg(_("cmd: %s"), cmd); + smsg(0, _("cmd: %s"), cmd); } // Repeat getting a command and executing it. @@ -352,7 +352,7 @@ static void do_checkbacktracelevel(void) if (debug_backtrace_level > max) { debug_backtrace_level = max; - smsg(_("frame at highest level: %d"), max); + smsg(0, _("frame at highest level: %d"), max); } xfree(sname); } @@ -371,9 +371,9 @@ static void do_showbacktrace(char *cmd) *next = NUL; } if (i == max - debug_backtrace_level) { - smsg("->%d %s", max - i, cur); + smsg(0, "->%d %s", max - i, cur); } else { - smsg(" %d %s", max - i, cur); + smsg(0, " %d %s", max - i, cur); } i++; if (next == NULL) { @@ -386,9 +386,9 @@ static void do_showbacktrace(char *cmd) } if (SOURCING_LNUM != 0) { - smsg(_("line %" PRId64 ": %s"), (int64_t)SOURCING_LNUM, cmd); + smsg(0, _("line %" PRId64 ": %s"), (int64_t)SOURCING_LNUM, cmd); } else { - smsg(_("cmd: %s"), cmd); + smsg(0, _("cmd: %s"), cmd); } } @@ -432,7 +432,7 @@ void dbg_check_breakpoint(exarg_T *eap) } else { p = ""; } - smsg(_("Breakpoint in \"%s%s\" line %" PRId64), + smsg(0, _("Breakpoint in \"%s%s\" line %" PRId64), p, debug_breakpoint_name + (*p == NUL ? 0 : 3), (int64_t)debug_breakpoint_lnum); @@ -729,13 +729,13 @@ void ex_breaklist(exarg_T *eap) home_replace(NULL, bp->dbg_name, NameBuff, MAXPATHL, true); } if (bp->dbg_type != DBG_EXPR) { - smsg(_("%3d %s %s line %" PRId64), + smsg(0, _("%3d %s %s line %" PRId64), bp->dbg_nr, bp->dbg_type == DBG_FUNC ? "func" : "file", bp->dbg_type == DBG_FUNC ? bp->dbg_name : NameBuff, (int64_t)bp->dbg_lnum); } else { - smsg(_("%3d expr %s"), bp->dbg_nr, bp->dbg_name); + smsg(0, _("%3d expr %s"), bp->dbg_nr, bp->dbg_name); } } } diff --git a/src/nvim/diff.c b/src/nvim/diff.c index c5783ef00e..4f2d510d8b 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -764,7 +764,7 @@ static int diff_write_buffer(buf_T *buf, mmfile_t *m, linenr_T start, linenr_T e buf->b_diff_failed = true; if (p_verbose > 0) { verbose_enter(); - smsg(_("Not enough memory to use internal diff for buffer \"%s\""), + smsg(0, _("Not enough memory to use internal diff for buffer \"%s\""), buf->b_fname); verbose_leave(); } diff --git a/src/nvim/eval.c b/src/nvim/eval.c index c7b706e0fc..c30009606f 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -5922,7 +5922,7 @@ void get_system_output_as_rettv(typval_T *argvars, typval_T *rettv, bool retlist if (p_verbose > 3) { char *cmdstr = shell_argv_to_str(argv); verbose_enter_scroll(); - smsg(_("Executing command: \"%s\""), cmdstr); + smsg(0, _("Executing command: \"%s\""), cmdstr); msg_puts("\n\n"); verbose_leave_scroll(); xfree(cmdstr); diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c index a5d7ed2758..0fe2396f8a 100644 --- a/src/nvim/eval/userfunc.c +++ b/src/nvim/eval/userfunc.c @@ -1117,7 +1117,7 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett no_wait_return++; verbose_enter_scroll(); - smsg(_("calling %s"), SOURCING_NAME); + smsg(0, _("calling %s"), SOURCING_NAME); if (p_verbose >= 14) { msg_puts("("); for (int i = 0; i < argcount; i++) { @@ -1235,9 +1235,9 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett verbose_enter_scroll(); if (aborting()) { - smsg(_("%s aborted"), SOURCING_NAME); + smsg(0, _("%s aborted"), SOURCING_NAME); } else if (fc->fc_rettv->v_type == VAR_NUMBER) { - smsg(_("%s returning #%" PRId64 ""), + smsg(0, _("%s returning #%" PRId64 ""), SOURCING_NAME, (int64_t)fc->fc_rettv->vval.v_number); } else { char buf[MSG_BUF_LEN]; @@ -1254,7 +1254,7 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett trunc_string(s, buf, MSG_BUF_CLEN, MSG_BUF_LEN); s = buf; } - smsg(_("%s returning %s"), SOURCING_NAME, s); + smsg(0, _("%s returning %s"), SOURCING_NAME, s); xfree(tofree); } } @@ -1277,7 +1277,7 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett no_wait_return++; verbose_enter_scroll(); - smsg(_("continuing in %s"), SOURCING_NAME); + smsg(0, _("continuing in %s"), SOURCING_NAME); msg_puts("\n"); // don't overwrite this either verbose_leave_scroll(); diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index bc82226d95..e9d8947bd3 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -836,8 +836,8 @@ int do_move(linenr_T line1, linenr_T line2, linenr_T dest) ml_delete(line1 + extra, true); } if (!global_busy && num_lines > p_report) { - smsg(NGETTEXT("%" PRId64 " line moved", - "%" PRId64 " lines moved", num_lines), + smsg(0, NGETTEXT("%" PRId64 " line moved", + "%" PRId64 " lines moved", num_lines), (int64_t)num_lines); } @@ -3800,8 +3800,8 @@ static int do_sub(exarg_T *eap, const proftime_T timeout, const long cmdpreview_ // needed msg_no_more = true; msg_ext_set_kind("confirm_sub"); - smsg_attr(HL_ATTR(HLF_R), // Same highlight as wait_return(). - _("replace with %s (y/n/a/q/l/^E/^Y)?"), sub); + // Same highlight as wait_return(). + smsg(HL_ATTR(HLF_R), _("replace with %s (y/n/a/q/l/^E/^Y)?"), sub); msg_no_more = false; msg_scroll = (int)i; if (!ui_has(kUIMessages)) { @@ -4470,9 +4470,9 @@ void ex_global(exarg_T *eap) msg(_(e_interr), 0); } else if (ndone == 0) { if (type == 'v') { - smsg(_("Pattern found in every line: %s"), used_pat); + smsg(0, _("Pattern found in every line: %s"), used_pat); } else { - smsg(_("Pattern not found: %s"), used_pat); + smsg(0, _("Pattern not found: %s"), used_pat); } } else { global_exe(cmd); diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 933de23316..c7ee71719d 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -273,9 +273,9 @@ static void msg_verbose_cmd(linenr_T lnum, char *cmd) verbose_enter_scroll(); if (lnum == 0) { - smsg(_("Executing: %s"), cmd); + smsg(0, _("Executing: %s"), cmd); } else { - smsg(_("line %" PRIdLINENR ": %s"), lnum, cmd); + smsg(0, _("line %" PRIdLINENR ": %s"), lnum, cmd); } if (msg_silent == 0) { msg_puts("\n"); // don't overwrite this @@ -5692,7 +5692,7 @@ static void ex_pwd(exarg_T *eap) } else if (curtab->tp_localdir != NULL) { context = "tabpage"; } - smsg("[%s] %s", context, NameBuff); + smsg(0, "[%s] %s", context, NameBuff); } else { msg(NameBuff, 0); } @@ -5709,7 +5709,7 @@ static void ex_equal(exarg_T *eap) ex_lua(eap); } else { eap->nextcmd = find_nextcmd(eap->arg); - smsg("%" PRId64, (int64_t)eap->line2); + smsg(0, "%" PRId64, (int64_t)eap->line2); } } @@ -7121,7 +7121,7 @@ static void ex_filetype(exarg_T *eap) { if (*eap->arg == NUL) { // Print current status. - smsg("filetype detection:%s plugin:%s indent:%s", + smsg(0, "filetype detection:%s plugin:%s indent:%s", filetype_detect == kTrue ? "ON" : "OFF", filetype_plugin == kTrue ? (filetype_detect == kTrue ? "ON" : "(on)") : "OFF", filetype_indent == kTrue ? (filetype_detect == kTrue ? "ON" : "(on)") : "OFF"); diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c index 0704b47d40..49bdf1088a 100644 --- a/src/nvim/ex_eval.c +++ b/src/nvim/ex_eval.c @@ -497,7 +497,7 @@ static int throw_exception(void *value, except_type_T type, char *cmdname) if (debug_break_level > 0 || *p_vfile == NUL) { msg_scroll = true; // always scroll up, don't overwrite } - smsg(_("Exception thrown: %s"), excp->value); + smsg(0, _("Exception thrown: %s"), excp->value); msg_puts("\n"); // don't overwrite this either if (debug_break_level > 0 || *p_vfile == NUL) { @@ -548,7 +548,7 @@ static void discard_exception(except_T *excp, bool was_finished) if (debug_break_level > 0 || *p_vfile == NUL) { msg_scroll = true; // always scroll up, don't overwrite } - smsg(was_finished ? _("Exception finished: %s") : _("Exception discarded: %s"), excp->value); + smsg(0, was_finished ? _("Exception finished: %s") : _("Exception discarded: %s"), excp->value); msg_puts("\n"); // don't overwrite this either if (debug_break_level > 0 || *p_vfile == NUL) { cmdline_row = msg_row; @@ -615,7 +615,7 @@ static void catch_exception(except_T *excp) if (debug_break_level > 0 || *p_vfile == NUL) { msg_scroll = true; // always scroll up, don't overwrite } - smsg(_("Exception caught: %s"), excp->value); + smsg(0, _("Exception caught: %s"), excp->value); msg_puts("\n"); // don't overwrite this either if (debug_break_level > 0 || *p_vfile == NUL) { @@ -732,7 +732,7 @@ static void report_pending(int action, int pending, void *value) } no_wait_return++; msg_scroll = true; // always scroll up, don't overwrite - smsg(mesg, s); + smsg(0, mesg, s); msg_puts("\n"); // don't overwrite this either cmdline_row = msg_row; no_wait_return--; diff --git a/src/nvim/file_search.c b/src/nvim/file_search.c index b5cdeff21c..338edbe719 100644 --- a/src/nvim/file_search.c +++ b/src/nvim/file_search.c @@ -615,7 +615,7 @@ char *vim_findfile(void *search_ctx_arg) #ifdef FF_VERBOSE if (p_verbose >= 5) { verbose_enter_scroll(); - smsg("Already Searched: %s (%s)", + smsg(0, "Already Searched: %s (%s)", stackp->ffs_fix_path, stackp->ffs_wc_path); msg_puts("\n"); // don't overwrite this either verbose_leave_scroll(); @@ -626,7 +626,7 @@ char *vim_findfile(void *search_ctx_arg) #ifdef FF_VERBOSE } else if (p_verbose >= 5) { verbose_enter_scroll(); - smsg("Searching: %s (%s)", + smsg(0, "Searching: %s (%s)", stackp->ffs_fix_path, stackp->ffs_wc_path); msg_puts("\n"); // don't overwrite this either verbose_leave_scroll(); @@ -798,7 +798,7 @@ char *vim_findfile(void *search_ctx_arg) file_path, "") == FAIL) { if (p_verbose >= 5) { verbose_enter_scroll(); - smsg("Already: %s", file_path); + smsg(0, "Already: %s", file_path); msg_puts("\n"); // don't overwrite this either verbose_leave_scroll(); } @@ -823,7 +823,7 @@ char *vim_findfile(void *search_ctx_arg) #ifdef FF_VERBOSE if (p_verbose >= 5) { verbose_enter_scroll(); - smsg("HIT: %s", file_path); + smsg(0, "HIT: %s", file_path); msg_puts("\n"); // don't overwrite this either verbose_leave_scroll(); } @@ -986,7 +986,7 @@ static ff_visited_list_hdr_T *ff_get_visited_list(char *filename, #ifdef FF_VERBOSE if (p_verbose >= 5) { verbose_enter_scroll(); - smsg("ff_get_visited_list: FOUND list for %s", filename); + smsg(0, "ff_get_visited_list: FOUND list for %s", filename); msg_puts("\n"); // don't overwrite this either verbose_leave_scroll(); } @@ -1000,7 +1000,7 @@ static ff_visited_list_hdr_T *ff_get_visited_list(char *filename, #ifdef FF_VERBOSE if (p_verbose >= 5) { verbose_enter_scroll(); - smsg("ff_get_visited_list: new list for %s", filename); + smsg(0, "ff_get_visited_list: new list for %s", filename); msg_puts("\n"); // don't overwrite this either verbose_leave_scroll(); } diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index cd88cf53ce..5cda5e48ec 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -3363,7 +3363,7 @@ int readdir_core(garray_T *gap, const char *path, void *context, CheckItem check Directory dir; if (!os_scandir(&dir, path)) { - smsg(_(e_notopen), path); + smsg(0, _(e_notopen), path); return FAIL; } diff --git a/src/nvim/help.c b/src/nvim/help.c index 698eda8468..a32a03de52 100644 --- a/src/nvim/help.c +++ b/src/nvim/help.c @@ -148,7 +148,7 @@ void ex_help(exarg_T *eap) // There is no help window yet. // Try to open the file specified by the "helpfile" option. if ((helpfd = os_fopen(p_hf, READBIN)) == NULL) { - smsg(_("Sorry, help file \"%s\" not found"), p_hf); + smsg(0, _("Sorry, help file \"%s\" not found"), p_hf); goto erret; } fclose(helpfd); diff --git a/src/nvim/input.c b/src/nvim/input.c index 4fd6297019..e867da7e1e 100644 --- a/src/nvim/input.c +++ b/src/nvim/input.c @@ -56,7 +56,7 @@ int ask_yesno(const char *const str, const bool direct) int r = ' '; while (r != 'y' && r != 'n') { // same highlighting as for wait_return() - smsg_attr(HL_ATTR(HLF_R), "%s (y/n)?", str); + smsg(HL_ATTR(HLF_R), "%s (y/n)?", str); if (direct) { r = get_keystroke(NULL); } else { diff --git a/src/nvim/lua/secure.c b/src/nvim/lua/secure.c index 30d5a95fc0..2552e21884 100644 --- a/src/nvim/lua/secure.c +++ b/src/nvim/lua/secure.c @@ -76,11 +76,11 @@ static bool nlua_trust(const char *action, const char *path) if (msg != NULL) { if (success) { if (strcmp(action, "allow") == 0) { - smsg("Allowed \"%s\" in trust database.", msg); + smsg(0, "Allowed \"%s\" in trust database.", msg); } else if (strcmp(action, "deny") == 0) { - smsg("Denied \"%s\" in trust database.", msg); + smsg(0, "Denied \"%s\" in trust database.", msg); } else if (strcmp(action, "remove") == 0) { - smsg("Removed \"%s\" from trust database.", msg); + smsg(0, "Removed \"%s\" from trust database.", msg); } } else { semsg(e_trustfile, msg); diff --git a/src/nvim/memline.c b/src/nvim/memline.c index 7b83fe24b0..230019c45c 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -918,14 +918,14 @@ void ml_recover(bool checkext) } home_replace(NULL, mfp->mf_fname, NameBuff, MAXPATHL, true); - smsg(_("Using swap file \"%s\""), NameBuff); + smsg(0, _("Using swap file \"%s\""), NameBuff); if (buf_spname(curbuf) != NULL) { xstrlcpy(NameBuff, buf_spname(curbuf), MAXPATHL); } else { home_replace(NULL, curbuf->b_ffname, NameBuff, MAXPATHL, true); } - smsg(_("Original file \"%s\""), NameBuff); + smsg(0, _("Original file \"%s\""), NameBuff); msg_putchar('\n'); // check date of swap file and original file diff --git a/src/nvim/message.c b/src/nvim/message.c index 8807524083..44fcd83af8 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -474,22 +474,8 @@ void trunc_string(const char *s, char *buf, int room_in, int buflen) } } -// Note: Caller of smsg() and smsg_attr() must check the resulting string is -// shorter than IOSIZE!!! - -int smsg(const char *s, ...) - FUNC_ATTR_PRINTF(1, 2) -{ - va_list arglist; - - va_start(arglist, s); - vim_vsnprintf(IObuff, IOSIZE, s, arglist); - va_end(arglist); - - return msg(IObuff, 0); -} - -int smsg_attr(int attr, const char *s, ...) +// Note: Caller of smsg() must check the resulting string is shorter than IOSIZE!!! +int smsg(int attr, const char *s, ...) FUNC_ATTR_PRINTF(2, 3) { va_list arglist; diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 9e85997ca0..d42ce03f9a 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -656,7 +656,7 @@ void op_reindent(oparg_T *oap, Indenter how) if (i > 1 && (i % 50 == 0 || i == oap->line_count - 1) && oap->line_count > p_report) { - smsg(_("%" PRId64 " lines to indent... "), (int64_t)i); + smsg(0, _("%" PRId64 " lines to indent... "), (int64_t)i); } // Be vi-compatible: For lisp indenting the first line is not @@ -699,9 +699,7 @@ void op_reindent(oparg_T *oap, Indenter how) if (oap->line_count > p_report) { i = oap->line_count - (i + 1); - smsg(NGETTEXT("%" PRId64 " line indented ", - "%" PRId64 " lines indented ", i), - (int64_t)i); + smsg(0, NGETTEXT("%" PRId64 " line indented ", "%" PRId64 " lines indented ", i), (int64_t)i); } if ((cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0) { // set '[ and '] marks @@ -2109,8 +2107,7 @@ void op_tilde(oparg_T *oap) } if (oap->line_count > p_report) { - smsg(NGETTEXT("%" PRId64 " line changed", - "%" PRId64 " lines changed", oap->line_count), + smsg(0, NGETTEXT("%" PRId64 " line changed", "%" PRId64 " lines changed", oap->line_count), (int64_t)oap->line_count); } } @@ -2783,12 +2780,12 @@ static void op_yank_reg(oparg_T *oap, bool message, yankreg_T *reg, bool append) update_screen(); } if (yank_type == kMTBlockWise) { - smsg(NGETTEXT("block of %" PRId64 " line yanked%s", - "block of %" PRId64 " lines yanked%s", yanklines), + smsg(0, NGETTEXT("block of %" PRId64 " line yanked%s", + "block of %" PRId64 " lines yanked%s", yanklines), (int64_t)yanklines, namebuf); } else { - smsg(NGETTEXT("%" PRId64 " line yanked%s", - "%" PRId64 " lines yanked%s", yanklines), + smsg(0, NGETTEXT("%" PRId64 " line yanked%s", + "%" PRId64 " lines yanked%s", yanklines), (int64_t)yanklines, namebuf); } } @@ -4452,8 +4449,7 @@ void op_addsub(oparg_T *oap, linenr_T Prenum1, bool g_cmd) } if (change_cnt > p_report) { - smsg(NGETTEXT("%" PRId64 " lines changed", - "%" PRId64 " lines changed", change_cnt), + smsg(0, NGETTEXT("%" PRId64 " lines changed", "%" PRId64 " lines changed", change_cnt), (int64_t)change_cnt); } } diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c index 6c3eca8961..c95b5defaa 100644 --- a/src/nvim/os/fs.c +++ b/src/nvim/os/fs.c @@ -76,7 +76,7 @@ int os_chdir(const char *path) { if (p_verbose >= 5) { verbose_enter(); - smsg("chdir(%s)", path); + smsg(0, "chdir(%s)", path); verbose_leave(); } return uv_chdir(path); diff --git a/src/nvim/os/lang.c b/src/nvim/os/lang.c index 8ca2aa3a4b..652b851903 100644 --- a/src/nvim/os/lang.c +++ b/src/nvim/os/lang.c @@ -197,7 +197,7 @@ void ex_language(exarg_T *eap) if (p == NULL || *p == NUL) { p = "Unknown"; } - smsg(_("Current %slanguage: \"%s\""), whatstr, p); + smsg(0, _("Current %slanguage: \"%s\""), whatstr, p); } else { # ifndef LC_MESSAGES if (what == VIM_LC_MESSAGES) { diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c index 582135349f..9b7b013edf 100644 --- a/src/nvim/os/shell.c +++ b/src/nvim/os/shell.c @@ -732,7 +732,7 @@ int call_shell(char *cmd, ShellOpts opts, char *extra_shell_arg) if (p_verbose > 3) { verbose_enter(); - smsg(_("Executing command: \"%s\""), cmd == NULL ? p_sh : cmd); + smsg(0, _("Executing command: \"%s\""), cmd == NULL ? p_sh : cmd); msg_putchar('\n'); verbose_leave(); } diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index b0c6fd79e2..a02c0eface 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -5458,7 +5458,7 @@ static int vgr_process_files(win_T *wp, qf_info_T *qi, vgr_args_T *cmd_args, boo if (buf == NULL) { if (!got_int) { - smsg(_("Cannot open file \"%s\""), fname); + smsg(0, _("Cannot open file \"%s\""), fname); } } else { // Try for a match in all lines of the buffer. diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index 14c7e56e97..de72c95fb2 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -2319,7 +2319,7 @@ regprog_T *vim_regcomp(const char *expr_arg, int re_flags) regexp_engine = expr[4] - '0'; expr += 5; #ifdef REGEXP_DEBUG - smsg("New regexp mode selected (%d): %s", + smsg(0, "New regexp mode selected (%d): %s", regexp_engine, regname[newengine]); #endif diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c index 4cb5925176..e6a04c899c 100644 --- a/src/nvim/runtime.c +++ b/src/nvim/runtime.c @@ -353,9 +353,9 @@ int do_in_path(const char *path, const char *prefix, char *name, int flags, if (p_verbose > 10 && name != NULL) { verbose_enter(); if (*prefix != NUL) { - smsg(_("Searching for \"%s\" under \"%s\" in \"%s\""), name, prefix, path); + smsg(0, _("Searching for \"%s\" under \"%s\" in \"%s\""), name, prefix, path); } else { - smsg(_("Searching for \"%s\" in \"%s\""), name, path); + smsg(0, _("Searching for \"%s\" in \"%s\""), name, path); } verbose_leave(); } @@ -396,7 +396,7 @@ int do_in_path(const char *path, const char *prefix, char *name, int flags, if (p_verbose > 10) { verbose_enter(); - smsg(_("Searching for \"%s\""), buf); + smsg(0, _("Searching for \"%s\""), buf); verbose_leave(); } @@ -418,7 +418,7 @@ int do_in_path(const char *path, const char *prefix, char *name, int flags, semsg(_(e_dirnotf), basepath, name); } else if (p_verbose > 1) { verbose_enter(); - smsg(_("not found in '%s': \"%s\""), basepath, name); + smsg(0, _("not found in '%s': \"%s\""), basepath, name); verbose_leave(); } } @@ -481,7 +481,7 @@ int do_in_cached_path(char *name, int flags, DoInRuntimepathCB callback, void *c if (p_verbose > 10 && name != NULL) { verbose_enter(); - smsg(_("Searching for \"%s\" in runtime path"), name); + smsg(0, _("Searching for \"%s\" in runtime path"), name); verbose_leave(); } @@ -520,7 +520,7 @@ int do_in_cached_path(char *name, int flags, DoInRuntimepathCB callback, void *c if (p_verbose > 10) { verbose_enter(); - smsg(_("Searching for \"%s\""), buf); + smsg(0, _("Searching for \"%s\""), buf); verbose_leave(); } @@ -540,7 +540,7 @@ int do_in_cached_path(char *name, int flags, DoInRuntimepathCB callback, void *c semsg(_(e_dirnotf), "runtime path", name); } else if (p_verbose > 1) { verbose_enter(); - smsg(_("not found in runtime path: \"%s\""), name); + smsg(0, _("not found in runtime path: \"%s\""), name); verbose_leave(); } } @@ -2047,7 +2047,7 @@ int do_source(char *fname, int check_other, int is_vimrc, int *ret_sid) return retval; } if (os_isdir(fname_exp)) { - smsg(_("Cannot source a directory: \"%s\""), fname); + smsg(0, _("Cannot source a directory: \"%s\""), fname); goto theend; } @@ -2091,9 +2091,9 @@ int do_source(char *fname, int check_other, int is_vimrc, int *ret_sid) if (p_verbose > 1) { verbose_enter(); if (SOURCING_NAME == NULL) { - smsg(_("could not source \"%s\""), fname); + smsg(0, _("could not source \"%s\""), fname) |