mirror of
https://github.com/neovim/neovim.git
synced 2025-09-05 19:08:15 +00:00
refactor: remove unnecessary allocation for "run Nvim with -V1" (#32633)
This commit is contained in:
@@ -8038,6 +8038,8 @@ void last_set_msg(sctx_T script_ctx)
|
|||||||
if (script_ctx.sc_lnum > 0) {
|
if (script_ctx.sc_lnum > 0) {
|
||||||
msg_puts(_(line_msg));
|
msg_puts(_(line_msg));
|
||||||
msg_outnum(script_ctx.sc_lnum);
|
msg_outnum(script_ctx.sc_lnum);
|
||||||
|
} else if (script_is_lua(script_ctx.sc_sid)) {
|
||||||
|
msg_puts(_(" (run Nvim with -V1 for more details)"));
|
||||||
}
|
}
|
||||||
if (should_free) {
|
if (should_free) {
|
||||||
xfree(p);
|
xfree(p);
|
||||||
|
@@ -2452,15 +2452,14 @@ char *get_scriptname(sctx_T script_ctx, bool *should_free)
|
|||||||
case SID_WINLAYOUT:
|
case SID_WINLAYOUT:
|
||||||
return _("changed window size");
|
return _("changed window size");
|
||||||
case SID_LUA:
|
case SID_LUA:
|
||||||
return _("Lua (run Nvim with -V1 for more details)");
|
return _("Lua");
|
||||||
case SID_API_CLIENT:
|
case SID_API_CLIENT:
|
||||||
snprintf(IObuff, IOSIZE, _("API client (channel id %" PRIu64 ")"), script_ctx.sc_chan);
|
snprintf(IObuff, IOSIZE, _("API client (channel id %" PRIu64 ")"), script_ctx.sc_chan);
|
||||||
return IObuff;
|
return IObuff;
|
||||||
case SID_STR:
|
case SID_STR:
|
||||||
return _("anonymous :source");
|
return _("anonymous :source");
|
||||||
default: {
|
default: {
|
||||||
scriptitem_T *const si = SCRIPT_ITEM(script_ctx.sc_sid);
|
char *const sname = SCRIPT_ITEM(script_ctx.sc_sid)->sn_name;
|
||||||
char *sname = si->sn_name;
|
|
||||||
if (sname == NULL) {
|
if (sname == NULL) {
|
||||||
snprintf(IObuff, IOSIZE, _("anonymous :source (script id %d)"),
|
snprintf(IObuff, IOSIZE, _("anonymous :source (script id %d)"),
|
||||||
script_ctx.sc_sid);
|
script_ctx.sc_sid);
|
||||||
@@ -2468,13 +2467,7 @@ char *get_scriptname(sctx_T script_ctx, bool *should_free)
|
|||||||
}
|
}
|
||||||
|
|
||||||
*should_free = true;
|
*should_free = true;
|
||||||
sname = home_replace_save(NULL, sname);
|
return home_replace_save(NULL, sname);
|
||||||
if (si->sn_lua && script_ctx.sc_lnum == 0) {
|
|
||||||
char *const ret = concat_str(sname, _(" (run Nvim with -V1 for more details)"));
|
|
||||||
xfree(sname);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
return sname;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user