patch 8.0.1496: clearing a pointer takes two lines
Problem: Clearing a pointer takes two lines.
Solution: Add VIM_CLEAR() and replace vim_clear(). (Hirohito Higashi,
closes #2629)
diff --git a/src/terminal.c b/src/terminal.c
index 02d0715..b67cd6c 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -1176,8 +1176,7 @@
set_terminal_mode(term_T *term, int normal_mode)
{
term->tl_normal_mode = normal_mode;
- vim_free(term->tl_status_text);
- term->tl_status_text = NULL;
+ VIM_CLEAR(term->tl_status_text);
if (term->tl_buffer == curbuf)
maketitle();
}
@@ -1739,10 +1738,8 @@
for (term = first_term; term != NULL; term = term->tl_next)
if (term->tl_job == job)
{
- vim_free(term->tl_title);
- term->tl_title = NULL;
- vim_free(term->tl_status_text);
- term->tl_status_text = NULL;
+ VIM_CLEAR(term->tl_title);
+ VIM_CLEAR(term->tl_status_text);
redraw_buf_and_status_later(term->tl_buffer, VALID);
did_one = TRUE;
}
@@ -2023,8 +2020,7 @@
#endif
else
term->tl_title = vim_strsave((char_u *)value->string);
- vim_free(term->tl_status_text);
- term->tl_status_text = NULL;
+ VIM_CLEAR(term->tl_status_text);
if (term == curbuf->b_term)
maketitle();
break;
@@ -2189,10 +2185,8 @@
term->tl_channel_closed = TRUE;
did_one = TRUE;
- vim_free(term->tl_title);
- term->tl_title = NULL;
- vim_free(term->tl_status_text);
- term->tl_status_text = NULL;
+ VIM_CLEAR(term->tl_title);
+ VIM_CLEAR(term->tl_status_text);
/* Unless in Terminal-Normal mode: clear the vterm. */
if (!term->tl_normal_mode)