mirror of
https://github.com/neovim/neovim.git
synced 2025-10-12 12:56:04 +00:00
refactor(term): use const for title and add len to buf_set_term_title()
This commit is contained in:
@@ -230,7 +230,7 @@ Terminal *terminal_open(buf_T *buf, TerminalOptions opts)
|
||||
set_option_value("wrap", false, NULL, OPT_LOCAL);
|
||||
set_option_value("list", false, NULL, OPT_LOCAL);
|
||||
if (buf->b_ffname != NULL) {
|
||||
buf_set_term_title(buf, buf->b_ffname);
|
||||
buf_set_term_title(buf, buf->b_ffname, strlen((char *)buf->b_ffname));
|
||||
}
|
||||
RESET_BINDING(curwin);
|
||||
// Reset cursor in current window.
|
||||
@@ -858,13 +858,13 @@ static int term_movecursor(VTermPos new, VTermPos old, int visible, void *data)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void buf_set_term_title(buf_T *buf, char *title)
|
||||
static void buf_set_term_title(buf_T *buf, const char *title, size_t len)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
Error err = ERROR_INIT;
|
||||
dict_set_var(buf->b_vars,
|
||||
STATIC_CSTR_AS_STRING("term_title"),
|
||||
STRING_OBJ(cstr_as_string(title)),
|
||||
STRING_OBJ(((String){ .data = (char *)title, .size = len })),
|
||||
false,
|
||||
false,
|
||||
&err);
|
||||
@@ -887,7 +887,7 @@ static int term_settermprop(VTermProp prop, VTermValue *val, void *data)
|
||||
|
||||
case VTERM_PROP_TITLE: {
|
||||
buf_T *buf = handle_get_buffer(term->buf_handle);
|
||||
buf_set_term_title(buf, val->string);
|
||||
buf_set_term_title(buf, val->string, strlen(val->string));
|
||||
break;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user