refactor(message): msg_puts_attr_len -> msg_puts_len

This commit is contained in:
bfredl
2023-09-29 16:10:28 +02:00
parent b07fd0e988
commit 8e11c18d49
3 changed files with 10 additions and 10 deletions

View File

@@ -5731,7 +5731,7 @@ void get_user_input(const typval_T *const argvars, typval_T *const rettv, const
p = lastnl + 1; p = lastnl + 1;
msg_start(); msg_start();
msg_clr_eos(); msg_clr_eos();
msg_puts_attr_len(prompt, p - prompt, echo_attr); msg_puts_len(prompt, p - prompt, echo_attr);
msg_didout = false; msg_didout = false;
msg_starthere(); msg_starthere();
} }

View File

@@ -1356,7 +1356,7 @@ static void list_one_var_a(const char *prefix, const char *name, const ptrdiff_t
msg_start(); msg_start();
msg_puts(prefix); msg_puts(prefix);
if (name != NULL) { // "a:" vars don't have a name stored if (name != NULL) { // "a:" vars don't have a name stored
msg_puts_attr_len(name, name_len, 0); msg_puts_len(name, name_len, 0);
} }
msg_putchar(' '); msg_putchar(' ');
msg_advance(22); msg_advance(22);

View File

@@ -1590,7 +1590,7 @@ int msg_outtrans_len(const char *msgstr, int len, int attr)
// Unprintable multi-byte char: print the printable chars so // Unprintable multi-byte char: print the printable chars so
// far and the translation of the unprintable char. // far and the translation of the unprintable char.
if (str > plain_start) { if (str > plain_start) {
msg_puts_attr_len(plain_start, str - plain_start, attr); msg_puts_len(plain_start, str - plain_start, attr);
} }
plain_start = str + mb_l; plain_start = str + mb_l;
msg_puts_attr(transchar_buf(NULL, c), attr == 0 ? HL_ATTR(HLF_8) : attr); msg_puts_attr(transchar_buf(NULL, c), attr == 0 ? HL_ATTR(HLF_8) : attr);
@@ -1604,7 +1604,7 @@ int msg_outtrans_len(const char *msgstr, int len, int attr)
// Unprintable char: print the printable chars so far and the // Unprintable char: print the printable chars so far and the
// translation of the unprintable char. // translation of the unprintable char.
if (str > plain_start) { if (str > plain_start) {
msg_puts_attr_len(plain_start, str - plain_start, attr); msg_puts_len(plain_start, str - plain_start, attr);
} }
plain_start = str + 1; plain_start = str + 1;
msg_puts_attr(s, attr == 0 ? HL_ATTR(HLF_8) : attr); msg_puts_attr(s, attr == 0 ? HL_ATTR(HLF_8) : attr);
@@ -1618,7 +1618,7 @@ int msg_outtrans_len(const char *msgstr, int len, int attr)
if (str > plain_start && !got_int) { if (str > plain_start && !got_int) {
// Print the printable chars at the end. // Print the printable chars at the end.
msg_puts_attr_len(plain_start, str - plain_start, attr); msg_puts_len(plain_start, str - plain_start, attr);
} }
got_int |= save_got_int; got_int |= save_got_int;
@@ -2040,7 +2040,7 @@ void msg_outtrans_long(const char *longstr, int attr)
/// Basic function for writing a message with highlight attributes. /// Basic function for writing a message with highlight attributes.
void msg_puts_attr(const char *const s, const int attr) void msg_puts_attr(const char *const s, const int attr)
{ {
msg_puts_attr_len(s, -1, attr); msg_puts_len(s, -1, attr);
} }
/// Write a message with highlight attributes /// Write a message with highlight attributes
@@ -2048,7 +2048,7 @@ void msg_puts_attr(const char *const s, const int attr)
/// @param[in] str NUL-terminated message string. /// @param[in] str NUL-terminated message string.
/// @param[in] len Length of the string or -1. /// @param[in] len Length of the string or -1.
/// @param[in] attr Highlight attribute. /// @param[in] attr Highlight attribute.
void msg_puts_attr_len(const char *const str, const ptrdiff_t len, int attr) void msg_puts_len(const char *const str, const ptrdiff_t len, int attr)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_ALL
{ {
assert(len < 0 || memchr(str, 0, (size_t)len) == NULL); assert(len < 0 || memchr(str, 0, (size_t)len) == NULL);
@@ -2124,7 +2124,7 @@ void msg_printf_attr(const int attr, const char *const fmt, ...)
va_end(ap); va_end(ap);
msg_scroll = true; msg_scroll = true;
msg_puts_attr_len(msgbuf, (ptrdiff_t)len, attr); msg_puts_len(msgbuf, (ptrdiff_t)len, attr);
} }
static void msg_ext_emit_chunk(void) static void msg_ext_emit_chunk(void)
@@ -2141,7 +2141,7 @@ static void msg_ext_emit_chunk(void)
ADD(msg_ext_chunks, ARRAY_OBJ(chunk)); ADD(msg_ext_chunks, ARRAY_OBJ(chunk));
} }
/// The display part of msg_puts_attr_len(). /// The display part of msg_puts_len().
/// May be called recursively to display scroll-back text. /// May be called recursively to display scroll-back text.
static void msg_puts_display(const char *str, int maxlen, int attr, int recurse) static void msg_puts_display(const char *str, int maxlen, int attr, int recurse)
{ {
@@ -2681,7 +2681,7 @@ static msgchunk_T *disp_sb_line(int row, msgchunk_T *smp)
return mp->sb_next; return mp->sb_next;
} }
/// Output any postponed text for msg_puts_attr_len(). /// Output any postponed text for msg_puts_len().
static void t_puts(int *t_col, const char *t_s, const char *s, int attr) static void t_puts(int *t_col, const char *t_s, const char *s, int attr)
{ {
attr = hl_combine_attr(HL_ATTR(HLF_MSG), attr); attr = hl_combine_attr(HL_ATTR(HLF_MSG), attr);