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); } else { - smsg(_("line %" PRId64 ": could not source \"%s\""), + smsg(0, _("line %" PRId64 ": could not source \"%s\""), (int64_t)SOURCING_LNUM, fname); } verbose_leave(); @@ -2107,9 +2107,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(_("sourcing \"%s\""), fname); + smsg(0, _("sourcing \"%s\""), fname); } else { - smsg(_("line %" PRId64 ": sourcing \"%s\""), (int64_t)SOURCING_LNUM, fname); + smsg(0, _("line %" PRId64 ": sourcing \"%s\""), (int64_t)SOURCING_LNUM, fname); } verbose_leave(); } @@ -2242,9 +2242,9 @@ int do_source(char *fname, int check_other, int is_vimrc, int *ret_sid) estack_pop(); if (p_verbose > 1) { verbose_enter(); - smsg(_("finished sourcing %s"), fname); + smsg(0, _("finished sourcing %s"), fname); if (SOURCING_NAME != NULL) { - smsg(_("continuing in %s"), SOURCING_NAME); + smsg(0, _("continuing in %s"), SOURCING_NAME); } verbose_leave(); } diff --git a/src/nvim/search.c b/src/nvim/search.c index 9b4c5be485..87a591ea35 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -3798,7 +3798,7 @@ void find_pattern_in_path(char *ptr, Direction dir, size_t len, bool whole, bool msg_trunc(IObuff, true, HL_ATTR(HLF_R)); } else if (p_verbose >= 5) { verbose_enter(); - smsg(_("Searching included file %s"), new_fname); + smsg(0, _("Searching included file %s"), new_fname); verbose_leave(); } } diff --git a/src/nvim/shada.c b/src/nvim/shada.c index 658312d3b4..4fe9498af9 100644 --- a/src/nvim/shada.c +++ b/src/nvim/shada.c @@ -795,7 +795,7 @@ static int shada_read_file(const char *const file, const int flags) if (p_verbose > 1) { verbose_enter(); - smsg(_("Reading ShaDa file \"%s\"%s%s%s%s"), + smsg(0, _("Reading ShaDa file \"%s\"%s%s%s%s"), fname, (flags & kShaDaWantInfo) ? _(" info") : "", (flags & kShaDaWantMarks) ? _(" marks") : "", @@ -3049,7 +3049,7 @@ shada_write_file_nomerge: {} if (p_verbose > 1) { verbose_enter(); - smsg(_("Writing ShaDa file \"%s\""), fname); + smsg(0, _("Writing ShaDa file \"%s\""), fname); verbose_leave(); } diff --git a/src/nvim/sign.c b/src/nvim/sign.c index e30dffa294..7fde0b3f62 100644 --- a/src/nvim/sign.c +++ b/src/nvim/sign.c @@ -1660,7 +1660,7 @@ static void sign_get_placed(buf_T *buf, linenr_T lnum, int sign_id, const char * /// List one sign. static void sign_list_defined(sign_T *sp) { - smsg("sign %s", sp->sn_name); + smsg(0, "sign %s", sp->sn_name); if (sp->sn_icon != NULL) { msg_puts(" icon="); msg_outtrans(sp->sn_icon, 0); diff --git a/src/nvim/spell.c b/src/nvim/spell.c index 38e045a08b..1c7707995f 100644 --- a/src/nvim/spell.c +++ b/src/nvim/spell.c @@ -1626,7 +1626,7 @@ static void spell_load_lang(char *lang) lang); do_cmdline_cmd(autocmd_buf); } else { - smsg(_("Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\""), + smsg(0, _("Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\""), lang, spell_enc(), lang); } } else if (sl.sl_slang != NULL) { @@ -2076,7 +2076,7 @@ char *parse_spelllang(win_T *wp) } else { // This is probably an error. Give a warning and // accept the words anyway. - smsg(_("Warning: region %s not supported"), + smsg(0, _("Warning: region %s not supported"), region); } } else { diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c index 1d93fe4cff..e8ae6703c7 100644 --- a/src/nvim/spellfile.c +++ b/src/nvim/spellfile.c @@ -612,14 +612,14 @@ slang_T *spell_load_file(char *fname, char *lang, slang_T *old_lp, bool silent) semsg(_(e_notopen), fname); } else if (p_verbose > 2) { verbose_enter(); - smsg(e_notopen, fname); + smsg(0, e_notopen, fname); verbose_leave(); } goto endFAIL; } if (p_verbose > 2) { verbose_enter(); - smsg(_("Reading spell file \"%s\""), fname); + smsg(0, _("Reading spell file \"%s\""), fname); verbose_leave(); } @@ -2097,7 +2097,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname) if (spin->si_conv.vc_type != CONV_NONE) { pc = string_convert(&spin->si_conv, rline, NULL); if (pc == NULL) { - smsg(_("Conversion failure for word in %s line %d: %s"), + smsg(0, _("Conversion failure for word in %s line %d: %s"), fname, lnum, rline); continue; } @@ -2144,7 +2144,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname) aff->af_enc = enc_canonize(items[1]); if (!spin->si_ascii && convert_setup(&spin->si_conv, aff->af_enc, p_enc) == FAIL) { - smsg(_("Conversion in %s not supported: from %s to %s"), + smsg(0, _("Conversion in %s not supported: from %s to %s"), fname, aff->af_enc, p_enc); } spin->si_conv.vc_fail = true; @@ -2157,7 +2157,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname) } else if (strcmp(items[1], "caplong") == 0) { aff->af_flagtype = AFT_CAPLONG; } else { - smsg(_("Invalid value for FLAG in %s line %d: %s"), + smsg(0, _("Invalid value for FLAG in %s line %d: %s"), fname, lnum, items[1]); } if (aff->af_rare != 0 @@ -2171,7 +2171,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname) || compflags != NULL || aff->af_suff.ht_used > 0 || aff->af_pref.ht_used > 0) { - smsg(_("FLAG after using flags in %s line %d: %s"), + smsg(0, _("FLAG after using flags in %s line %d: %s"), fname, lnum, items[1]); } } else if (spell_info_item(items[0]) && itemcnt > 1) { @@ -2223,14 +2223,16 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname) && aff->af_compforbid == 0) { aff->af_compforbid = affitem2flag(aff->af_flagtype, items[1], fname, lnum); if (aff->af_pref.ht_used > 0) { - smsg(_("Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line %d"), + smsg(0, + _("Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line %d"), fname, lnum); } } else if (is_aff_rule(items, itemcnt, "COMPOUNDPERMITFLAG", 2) && aff->af_comppermit == 0) { aff->af_comppermit = affitem2flag(aff->af_flagtype, items[1], fname, lnum); if (aff->af_pref.ht_used > 0) { - smsg(_("Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line %d"), + smsg(0, + _("Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line %d"), fname, lnum); } } else if (is_aff_rule(items, itemcnt, "COMPOUNDFLAG", 2) @@ -2245,7 +2247,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname) // We don't use the count, but do check that it's a number and // not COMPOUNDRULE mistyped. if (atoi(items[1]) == 0) { - smsg(_("Wrong COMPOUNDRULES value in %s line %d: %s"), + smsg(0, _("Wrong COMPOUNDRULES value in %s line %d: %s"), fname, lnum, items[1]); } } else if (is_aff_rule(items, itemcnt, "COMPOUNDRULE", 2)) { @@ -2269,21 +2271,21 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname) && compmax == 0) { compmax = atoi(items[1]); if (compmax == 0) { - smsg(_("Wrong COMPOUNDWORDMAX value in %s line %d: %s"), + smsg(0, _("Wrong COMPOUNDWORDMAX value in %s line %d: %s"), fname, lnum, items[1]); } } else if (is_aff_rule(items, itemcnt, "COMPOUNDMIN", 2) && compminlen == 0) { compminlen = atoi(items[1]); if (compminlen == 0) { - smsg(_("Wrong COMPOUNDMIN value in %s line %d: %s"), + smsg(0, _("Wrong COMPOUNDMIN value in %s line %d: %s"), fname, lnum, items[1]); } } else if (is_aff_rule(items, itemcnt, "COMPOUNDSYLMAX", 2) && compsylmax == 0) { compsylmax = atoi(items[1]); if (compsylmax == 0) { - smsg(_("Wrong COMPOUNDSYLMAX value in %s line %d: %s"), + smsg(0, _("Wrong COMPOUNDSYLMAX value in %s line %d: %s"), fname, lnum, items[1]); } } else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDDUP", 1)) { @@ -2296,7 +2298,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname) compoptions |= COMP_CHECKTRIPLE; } else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 2)) { if (atoi(items[1]) == 0) { - smsg(_("Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s"), + smsg(0, _("Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s"), fname, lnum, items[1]); } } else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 3)) { @@ -2352,11 +2354,11 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname) if (!HASHITEM_EMPTY(hi)) { cur_aff = HI2AH(hi); if (cur_aff->ah_combine != (*items[2] == 'Y')) { - smsg(_("Different combining flag in continued affix block in %s line %d: %s"), + smsg(0, _("Different combining flag in continued affix block in %s line %d: %s"), fname, lnum, items[1]); } if (!cur_aff->ah_follows) { - smsg(_("Duplicate affix in %s line %d: %s"), + smsg(0, _("Duplicate affix in %s line %d: %s"), fname, lnum, items[1]); } } else { @@ -2374,9 +2376,8 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname) || cur_aff->ah_flag == aff->af_nosuggest || cur_aff->ah_flag == aff->af_needcomp || cur_aff->ah_flag == aff->af_comproot) { - smsg(_("Affix also used for " - "BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST " - "in %s line %d: %s"), + smsg(0, _("Affix also used for BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST " + "in %s line %d: %s"), fname, lnum, items[1]); } STRCPY(cur_aff->ah_key, items[1]); @@ -2400,11 +2401,11 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname) if (itemcnt > lasti && !aff->af_ignoreextra && *items[lasti] != '#') { - smsg(_(e_afftrailing), fname, lnum, items[lasti]); + smsg(0, _(e_afftrailing), fname, lnum, items[lasti]); } if (strcmp(items[2], "Y") != 0 && strcmp(items[2], "N") != 0) { - smsg(_("Expected Y or N in %s line %d: %s"), + smsg(0, _("Expected Y or N in %s line %d: %s"), fname, lnum, items[2]); } @@ -2440,7 +2441,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname) if (itemcnt > lasti && *items[lasti] != '#' && (strcmp(items[lasti], "-") != 0 || itemcnt != lasti + 1)) { - smsg(_(e_afftrailing), fname, lnum, items[lasti]); + smsg(0, _(e_afftrailing), fname, lnum, items[lasti]); } // New item for an affix letter. @@ -2475,7 +2476,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname) snprintf(buf, sizeof(buf), *items[0] == 'P' ? "^%s" : "%s$", items[4]); aff_entry->ae_prog = vim_regcomp(buf, RE_MAGIC + RE_STRING + RE_STRICT); if (aff_entry->ae_prog == NULL) { - smsg(_("Broken condition in %s line %d: %s"), + smsg(0, _("Broken condition in %s line %d: %s"), fname, lnum, items[4]); } } @@ -2587,7 +2588,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname) || is_aff_rule(items, itemcnt, "REPSAL", 2)) { // Ignore REP/REPSAL count if (!isdigit((uint8_t)(*items[1]))) { - smsg(_("Expected REP(SAL) count in %s line %d"), + smsg(0, _("Expected REP(SAL) count in %s line %d"), fname, lnum); } } else if ((strcmp(items[0], "REP") == 0 @@ -2597,7 +2598,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname) // Myspell ignores extra arguments, we require it starts with // # to detect mistakes. if (itemcnt > 3 && items[3][0] != '#') { - smsg(_(e_afftrailing), fname, lnum, items[3]); + smsg(0, _(e_afftrailing), fname, lnum, items[3]); } if (items[0][3] == 'S' ? do_repsal : do_rep) { // Replace underscore with space (can't include a space @@ -2622,7 +2623,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname) // First line contains the count. found_map = true; if (!isdigit((uint8_t)(*items[1]))) { - smsg(_("Expected MAP count in %s line %d"), + smsg(0, _("Expected MAP count in %s line %d"), fname, lnum); } } else if (do_mapline) { @@ -2633,7 +2634,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname) && vim_strchr(spin->si_map.ga_data, c) != NULL) || vim_strchr(p, c) != NULL) { - smsg(_("Duplicate character in MAP in %s line %d"), + smsg(0, _("Duplicate character in MAP in %s line %d"), fname, lnum); } } @@ -2676,7 +2677,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname) } } } else { - smsg(_("Unrecognized or duplicate item in %s line %d: %s"), + smsg(0, _("Unrecognized or duplicate item in %s line %d: %s"), fname, lnum, items[0]); } } @@ -2708,7 +2709,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname) if (compsylmax != 0) { if (syllable == NULL) { - smsg("%s", _("COMPOUNDSYLMAX used without SYLLABLE")); + smsg(0, "%s", _("COMPOUNDSYLMAX used without SYLLABLE")); } aff_check_number(spin->si_compsylmax, compsylmax, "COMPOUNDSYLMAX"); spin->si_compsylmax = compsylmax; @@ -2741,10 +2742,10 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname) if (sofofrom != NULL || sofoto != NULL) { if (sofofrom == NULL || sofoto == NULL) { - smsg(_("Missing SOFO%s line in %s"), + smsg(0, _("Missing SOFO%s line in %s"), sofofrom == NULL ? "FROM" : "TO", fname); } else if (!GA_EMPTY(&spin->si_sal)) { - smsg(_("Both SAL and SOFO lines in %s"), fname); + smsg(0, _("Both SAL and SOFO lines in %s"), fname); } else { aff_check_string(spin->si_sofofr, sofofrom, "SOFOFROM"); aff_check_string(spin->si_sofoto, sofoto, "SOFOTO"); @@ -2822,15 +2823,15 @@ static unsigned affitem2flag(int flagtype, char *item, char *fname, int lnum) unsigned res = get_affitem(flagtype, &p); if (res == 0) { if (flagtype == AFT_NUM) { - smsg(_("Flag is not a number in %s line %d: %s"), + smsg(0, _("Flag is not a number in %s line %d: %s"), fname, lnum, item); } else { - smsg(_("Illegal flag in %s line %d: %s"), + smsg(0, _("Illegal flag in %s line %d: %s"), fname, lnum, item); } } if (*p != NUL) { - smsg(_(e_affname), fname, lnum, item); + smsg(0, _(e_affname), fname, lnum, item); return 0; } @@ -2993,7 +2994,7 @@ static bool flag_in_afflist(int flagtype, char *afflist, unsigned flag) static void aff_check_number(int spinval, int affval, char *name) { if (spinval != 0 && spinval != affval) { - smsg(_("%s value differs from what is used in another .aff file"), + smsg(0, _("%s value differs from what is used in another .aff file"), name); } } @@ -3002,7 +3003,7 @@ static void aff_check_number(int spinval, int affval, char *name) static void aff_check_string(char *spinval, char *affval, char *name) { if (spinval != NULL && strcmp(spinval, affval) != 0) { - smsg(_("%s value differs from what is used in another .aff file"), + smsg(0, _("%s value differs from what is used in another .aff file"), name); } } @@ -3139,7 +3140,7 @@ static int spell_read_dic(spellinfo_T *spin, char *fname, afffile_T *affile) if (spin->si_conv.vc_type != CONV_NONE) { pc = string_convert(&spin->si_conv, line, NULL); if (pc == NULL) { - smsg(_("Conversion failure for word in %s line %d: %s"), + smsg(0, _("Conversion failure for word in %s line %d: %s"), fname, lnum, line); continue; } @@ -3199,10 +3200,10 @@ static int spell_read_dic(spellinfo_T *spin, char *fname, afffile_T *affile) hi = hash_lookup(&ht, dw, strlen(dw), hash); if (!HASHITEM_EMPTY(hi)) { if (p_verbose > 0) { - smsg(_("Duplicate word in %s line %d: %s"), + smsg(0, _("Duplicate word in %s line %d: %s"), fname, lnum, dw); } else if (duplicate == 0) { - smsg(_("First duplicate word in %s line %d: %s"), + smsg(0, _("First duplicate word in %s line %d: %s"), fname, lnum, dw); } duplicate++; @@ -3263,10 +3264,10 @@ static int spell_read_dic(spellinfo_T *spin, char *fname, afffile_T *affile) } if (duplicate > 0) { - smsg(_("%d duplicate word(s) in %s"), duplicate, fname); + smsg(0, _("%d duplicate word(s) in %s"), duplicate, fname); } if (spin->si_ascii && non_ascii > 0) { - smsg(_("Ignored %d word(s) with non-ASCII characters in %s"), + smsg(0, _("Ignored %d word(s) with non-ASCII characters in %s"), non_ascii, fname); } hash_clear(&ht); @@ -3681,7 +3682,7 @@ static int spell_read_wordfile(spellinfo_T *spin, char *fname) if (spin->si_conv.vc_type != CONV_NONE) { pc = string_convert(&spin->si_conv, rline, NULL); if (pc == NULL) { - smsg(_("Conversion failure for word in %s line %ld: %s"), + smsg(0, _("Conversion failure for word in %s line %ld: %s"), fname, lnum, rline); continue; } @@ -3695,10 +3696,10 @@ static int spell_read_wordfile(spellinfo_T *spin, char *fname) line++; if (strncmp(line, "encoding=", 9) == 0) { if (spin->si_conv.vc_type != CONV_NONE) { - smsg(_("Duplicate /encoding= line ignored in %s line %ld: %s"), + smsg(0, _("Duplicate /encoding= line ignored in %s line %ld: %s"), fname, lnum, line - 1); } else if (did_word) { - smsg(_("/encoding= line after word ignored in %s line %ld: %s"), + smsg(0, _("/encoding= line after word ignored in %s line %ld: %s"), fname, lnum, line - 1); } else { char *enc; @@ -3708,7 +3709,7 @@ static int spell_read_wordfile(spellinfo_T *spin, char *fname) enc = enc_canonize(line); if (!spin->si_ascii && convert_setup(&spin->si_conv, enc, p_enc) == FAIL) { - smsg(_("Conversion in %s not supported: from %s to %s"), + smsg(0, _("Conversion in %s not supported: from %s to %s"), fname, line, p_enc); } xfree(enc); @@ -3719,12 +3720,12 @@ static int spell_read_wordfile(spellinfo_T *spin, char *fname) if (strncmp(line, "regions=", 8) == 0) { if (spin->si_region_count > 1) { - smsg(_("Duplicate /regions= line ignored in %s line %ld: %s"), + smsg(0, _("Duplicate /regions= line ignored in %s line %ld: %s"), fname, lnum, line); } else { line += 8; if (strlen(line) > MAXREGIONS * 2) { - smsg(_("Too many regions in %s line %ld: %s"), + smsg(0, _("Too many regions in %s line %ld: %s"), fname, lnum, line); } else { spin->si_region_count = (int)strlen(line) / 2; @@ -3737,7 +3738,7 @@ static int spell_read_wordfile(spellinfo_T *spin, char *fname) continue; } - smsg(_("/ line ignored in %s line %ld: %s"), + smsg(0, _("/ line ignored in %s line %ld: %s"), fname, lnum, line - 1); continue; } @@ -3764,13 +3765,13 @@ static int spell_read_wordfile(spellinfo_T *spin, char *fname) l = (uint8_t)(*p) - '0'; if (l == 0 || l > spin->si_region_count) { - smsg(_("Invalid region nr in %s line %ld: %s"), + smsg(0, _("Invalid region nr in %s line %ld: %s"), fname, lnum, p); break; } regionmask |= 1 << (l - 1); } else { - smsg(_("Unrecognized flags in %s line %ld: %s"), + smsg(0, _("Unrecognized flags in %s line %ld: %s"), fname, lnum, p); break; } @@ -4047,7 +4048,7 @@ static int tree_add_word(spellinfo_T *spin, const char *word, wordnode_T *root, node = *prev; } #ifdef SPELL_PRINTTREE - smsg("Added \"%s\"", word); + smsg(0, "Added \"%s\"", word); spell_print_tree(root->wn_sibling); #endif @@ -4924,7 +4925,7 @@ static void spell_make_sugfile(spellinfo_T *spin, char *wfname) goto theend; } - smsg(_("Number of words after soundfolding: %" PRId64), + smsg(0, _("Number of words after soundfolding: %" PRId64), (int64_t)spin->si_spellbuf->b_ml.ml_line_count); // Compress the soundfold trie. @@ -5035,7 +5036,7 @@ static int sug_filltree(spellinfo_T *spin, slang_T *slang) } } - smsg(_("Total number of words: %d"), words_done); + smsg(0, _("Total number of words: %d"), words_done); return OK; } @@ -5584,7 +5585,7 @@ void spell_add_word(char *word, int len, SpellAddType what, int idx, bool undo) fputc('#', fd); if (undo) { home_replace(NULL, fname, NameBuff, MAXPATHL, true); - smsg(_("Word '%.*s' removed from %s"), len, word, NameBuff); + smsg(0, _("Word '%.*s' removed from %s"), len, word, NameBuff); } } if (fseek(fd, fpos_next, SEEK_SET) != 0) { @@ -5634,7 +5635,7 @@ void spell_add_word(char *word, int len, SpellAddType what, int idx, bool undo) fclose(fd); home_replace(NULL, fname, NameBuff, MAXPATHL, true); - smsg(_("Word '%.*s' added to %s"), len, word, NameBuff); + smsg(0, _("Word '%.*s' added to %s"), len, word, NameBuff); } } diff --git a/src/nvim/spellsuggest.c b/src/nvim/spellsuggest.c index 4c1873eaca..1da61bbb2f 100644 --- a/src/nvim/spellsuggest.c +++ b/src/nvim/spellsuggest.c @@ -529,7 +529,7 @@ void spell_suggest(int count) msg(_("Sorry, no suggestions"), 0); } else if (count > 0) { if (count > sug.su_ga.ga_len) { - smsg(_("Sorry, only %" PRId64 " suggestions"), + smsg(0, _("Sorry, only %" PRId64 " suggestions"), (int64_t)sug.su_ga.ga_len); } } else { @@ -1480,9 +1480,9 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char *fword, bool soun int j; // print the stack of changes that brought us here - smsg("------ %s -------", fword); + smsg(0, "------ %s -------", fword); for (j = 0; j < depth; j++) { - smsg("%s", changename[j]); + smsg(0, "%s", changename[j]); } } #endif diff --git a/src/nvim/tag.c b/src/nvim/tag.c index c21b3a850b..a95b104027 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -719,7 +719,7 @@ void do_tag(char *tag, int type, int count, int forceit, int verbose) // Only when going to try the next match, report that the previous // file didn't exist. Otherwise an emsg() is given below. if (nofile_fname != NULL && error_cur_match != cur_match) { - smsg(_("File \"%s\" does not exist"), nofile_fname); + smsg(0, _("File \"%s\" does not exist"), nofile_fname); } ic = (matches[cur_match][0] & MT_IC_OFF); @@ -2211,7 +2211,7 @@ static void findtags_in_file(findtags_state_T *st, int flags, char *buf_ffname) if (p_verbose >= 5) { verbose_enter(); - smsg(_("Searching tags file %s"), st->tag_fname); + smsg(0, _("Searching tags file %s"), st->tag_fname); verbose_leave(); } st->did_open = true; // remember that we found at least one file @@ -3279,7 +3279,7 @@ static int add_tag_field(dict_T *dict, const char *field_name, const char *start if (tv_dict_find(dict, field_name, -1) != NULL) { if (p_verbose > 0) { verbose_enter(); - smsg(_("Duplicate field name: %s"), field_name); + smsg(0, _("Duplicate field name: %s"), field_name); verbose_leave(); } return FAIL; diff --git a/src/nvim/undo.c b/src/nvim/undo.c index 211d84529d..f8e1dffe8c 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -183,12 +183,12 @@ static void u_check_tree(u_header_T *uhp, u_header_T *exp_uh_next, u_header_T *e // Check pointers back are correct. if (uhp->uh_next.ptr != exp_uh_next) { emsg("uh_next wrong"); - smsg("expected: 0x%x, actual: 0x%x", + smsg(0, "expected: 0x%x, actual: 0x%x", exp_uh_next, uhp->uh_next.ptr); } if (uhp->uh_alt_prev.ptr != exp_uh_alt_prev) { emsg("uh_alt_prev wrong"); - smsg("expected: 0x%x, actual: 0x%x", + smsg(0, "expected: 0x%x, actual: 0x%x", exp_uh_alt_prev, uhp->uh_alt_prev.ptr); } @@ -225,7 +225,7 @@ static void u_check(int newhead_may_be_NULL) } if (header_count != curbuf->b_u_numhead) { emsg("b_u_numhead invalid"); - smsg("expected: %" PRId64 ", actual: %" PRId64, + smsg(0, "expected: %" PRId64 ", actual: %" PRId64, (int64_t)header_count, (int64_t)curbuf->b_u_numhead); } } @@ -1179,7 +1179,7 @@ void u_write_undo(const char *const name, const bool forceit, buf_T *const buf, if (file_name == NULL) { if (p_verbose > 0) { verbose_enter(); - smsg("%s", _("Cannot write undo file in any directory in 'undodir'")); + smsg(0, "%s", _("Cannot write undo file in any directory in 'undodir'")); verbose_leave(); } return; @@ -1215,7 +1215,7 @@ void u_write_undo(const char *const name, const bool forceit, buf_T *const buf, if (name == NULL) { verbose_enter(); } - smsg(_("Will not overwrite with undo file, cannot read: %s"), + smsg(0, _("Will not overwrite with undo file, cannot read: %s"), file_name); if (name == NULL) { verbose_leave(); @@ -1232,7 +1232,7 @@ void u_write_undo(const char *const name, const bool forceit, buf_T *const buf, if (name == NULL) { verbose_enter(); } - smsg(_("Will not overwrite, this is not an undo file: %s"), + smsg(0, _("Will not overwrite, this is not an undo file: %s"), file_name); if (name == NULL) { verbose_leave(); @@ -1262,7 +1262,7 @@ void u_write_undo(const char *const name, const bool forceit, buf_T *const buf, (void)os_setperm(file_name, perm); if (p_verbose > 0) { verbose_enter(); - smsg(_("Writing undo file: %s"), file_name); + smsg(0, _("Writing undo file: %s"), file_name); verbose_leave(); } @@ -1399,7 +1399,7 @@ void u_read_undo(char *name, const uint8_t *hash, const char *orig_name FUNC_ATT && file_info_undo.stat.st_uid != getuid()) { if (p_verbose > 0) { verbose_enter(); - smsg(_("Not reading undo file, owner differs: %s"), + smsg(0, _("Not reading undo file, owner differs: %s"), file_name); verbose_leave(); } @@ -1412,7 +1412,7 @@ void u_read_undo(char *name, const uint8_t *hash, const char *orig_name FUNC_ATT if (p_verbose > 0) { verbose_enter(); - smsg(_("Reading undo file: %s"), file_name); + smsg(0, _("Reading undo file: %s"), file_name); verbose_leave(); } @@ -1648,7 +1648,7 @@ void u_read_undo(char *name, const uint8_t *hash, const char *orig_name FUNC_ATT #endif if (name != NULL) { - smsg(_("Finished reading undo file %s"), file_name); + smsg(0, _("Finished reading undo file %s"), file_name); } goto theend; |