refactor(messages): fold msg_outtrans_attr into msg_outtrans

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 21:46:39 +02:00
parent 26d6f03023
commit f91cd31d7d
26 changed files with 91 additions and 108 deletions

View File

@@ -2946,9 +2946,9 @@ static void syn_cmd_iskeyword(exarg_T *eap, int syncing)
msg_puts("\n");
if (curwin->w_s->b_syn_isk != empty_option) {
msg_puts("syntax iskeyword ");
msg_outtrans(curwin->w_s->b_syn_isk);
msg_outtrans(curwin->w_s->b_syn_isk, 0);
} else {
msg_outtrans(_("syntax iskeyword not set"));
msg_outtrans(_("syntax iskeyword not set"), 0);
}
} else {
if (STRNICMP(arg, "clear", 5) == 0) {
@@ -3427,7 +3427,7 @@ static void syn_list_one(const int id, const bool syncing, const bool link_only)
msg_putchar(' ');
if (spp->sp_sync_idx >= 0) {
msg_outtrans(highlight_group_name(SYN_ITEMS(curwin->w_s)
[spp->sp_sync_idx].sp_syn.id - 1));
[spp->sp_sync_idx].sp_syn.id - 1), 0);
} else {
msg_puts("NONE");
}
@@ -3440,7 +3440,7 @@ static void syn_list_one(const int id, const bool syncing, const bool link_only)
(void)syn_list_header(did_header, 0, id, true);
msg_puts_attr("links to", attr);
msg_putchar(' ');
msg_outtrans(highlight_group_name(highlight_link_id(id - 1) - 1));
msg_outtrans(highlight_group_name(highlight_link_id(id - 1) - 1), 0);
}
}
@@ -3461,7 +3461,7 @@ static void syn_list_cluster(int id)
// slight hack: roughly duplicate the guts of syn_list_header()
msg_putchar('\n');
msg_outtrans(SYN_CLSTR(curwin->w_s)[id].scl_name);
msg_outtrans(SYN_CLSTR(curwin->w_s)[id].scl_name, 0);
if (msg_col >= endcol) { // output at least one space
endcol = msg_col + 1;
@@ -3498,9 +3498,9 @@ static void put_id_list(const char *const name, const int16_t *const list, const
int scl_id = *p - SYNID_CLUSTER;
msg_putchar('@');
msg_outtrans(SYN_CLSTR(curwin->w_s)[scl_id].scl_name);
msg_outtrans(SYN_CLSTR(curwin->w_s)[scl_id].scl_name, 0);
} else {
msg_outtrans(highlight_group_name(*p - 1));
msg_outtrans(highlight_group_name(*p - 1), 0);
}
if (p[1]) {
msg_putchar(',');
@@ -3520,9 +3520,9 @@ static void put_pattern(const char *const s, const int c, const synpat_T *const
msg_puts_attr("matchgroup", attr);
msg_putchar('=');
if (last_matchgroup == 0) {
msg_outtrans("NONE");
msg_outtrans("NONE", 0);
} else {
msg_outtrans(highlight_group_name(last_matchgroup - 1));
msg_outtrans(highlight_group_name(last_matchgroup - 1), 0);
}
msg_putchar(' ');
}
@@ -3539,7 +3539,7 @@ static void put_pattern(const char *const s, const int c, const synpat_T *const
}
}
msg_putchar(sepchars[i]);
msg_outtrans(spp->sp_pattern);
msg_outtrans(spp->sp_pattern, 0);
msg_putchar(sepchars[i]);
// output any pattern options
@@ -3649,7 +3649,7 @@ static bool syn_list_keywords(const int id, const hashtab_T *const ht, bool did_
prev_skipempty = (kp->flags & HL_SKIPEMPTY);
}
}
msg_outtrans(kp->keyword);
msg_outtrans(kp->keyword, 0);
}
}
}
@@ -5682,7 +5682,7 @@ static void syntime_report(void)
msg_puts(profile_msg(p->average));
msg_puts(" ");
msg_advance(50);
msg_outtrans(highlight_group_name(p->id - 1));
msg_outtrans(highlight_group_name(p->id - 1), 0);
msg_puts(" ");
msg_advance(69);
@@ -5695,7 +5695,7 @@ static void syntime_report(void)
if (len > (int)strlen(p->pattern)) {
len = (int)strlen(p->pattern);
}
msg_outtrans_len(p->pattern, len);
msg_outtrans_len(p->pattern, len, 0);
msg_puts("\n");
}
ga_clear(&ga);