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
This commit is contained in:
bfredl
2023-09-27 22:21:17 +02:00
parent f91cd31d7d
commit b85f1dafc7
35 changed files with 275 additions and 289 deletions

View File

@@ -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