From 6752ac49682d63dfc7960e518ecbd6517c88392d Mon Sep 17 00:00:00 2001 From: VVKot Date: Sat, 13 Feb 2021 19:06:37 +0000 Subject: vim-patch:8.1.0105: all tab stops are the same Problem: All tab stops are the same. Solution: Add the variable tabstop feature. (Christian Brabandt, closes vim/vim#2711) https://github.com/vim/vim/commit/04958cbaf25eea27eceedaa987adfb354ad5f7fd --- src/nvim/buffer.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'src/nvim/buffer.c') diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index c42a0e2dad..1daedb90b5 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -282,7 +282,7 @@ int open_buffer( // Set/reset the Changed flag first, autocmds may change the buffer. // Apply the automatic commands, before processing the modelines. - // So the modelines have priority over auto commands. + // So the modelines have priority over autocommands. // When reading stdin, the buffer contents always needs writing, so set // the changed flag. Unless in readonly mode: "ls | nvim -R -". @@ -1946,6 +1946,20 @@ void free_buf_options(buf_T *buf, int free_p_ff) clear_string_option(&buf->b_p_fo); clear_string_option(&buf->b_p_flp); clear_string_option(&buf->b_p_isk); + clear_string_option(&buf->b_p_vsts); + if (buf->b_p_vsts_nopaste) { + xfree(buf->b_p_vsts_nopaste); + } + buf->b_p_vsts_nopaste = NULL; + if (buf->b_p_vsts_array) { + xfree(buf->b_p_vsts_array); + } + buf->b_p_vsts_array = NULL; + clear_string_option(&buf->b_p_vts); + if (buf->b_p_vts_array) { + xfree(buf->b_p_vts_array); + } + buf->b_p_vts_array = NULL; clear_string_option(&buf->b_p_keymap); keymap_ga_clear(&buf->b_kmap_ga); ga_clear(&buf->b_kmap_ga); @@ -5375,8 +5389,8 @@ bool bt_terminal(const buf_T *const buf) return buf != NULL && buf->b_p_bt[0] == 't'; } -// Return true if "buf" is a "nofile", "acwrite" or "terminal" buffer. -// This means the buffer name is not a file name. +// Return true if "buf" is a "nofile", "acwrite", "terminal" or "prompt" +// buffer. This means the buffer name is not a file name. bool bt_nofile(const buf_T *const buf) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT { @@ -5386,7 +5400,8 @@ bool bt_nofile(const buf_T *const buf) || buf->b_p_bt[0] == 'p'); } -// Return true if "buf" is a "nowrite", "nofile" or "terminal" buffer. +// Return true if "buf" is a "nowrite", "nofile", "terminal" or "prompt" +// buffer. bool bt_dontwrite(const buf_T *const buf) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT { -- cgit From a70d904ad0e2037c7fb2ae10a20f840af3544496 Mon Sep 17 00:00:00 2001 From: VVKot Date: Tue, 2 Feb 2021 06:57:54 +0000 Subject: vim-patch:8.1.0936: may leak memory when using 'vartabstop' Problem: May leak memory when using 'vartabstop'. (Kuang-che Wu) Solution: Fix handling allocated memory for 'vartabstop'. (closes vim/vim#3976) https://github.com/vim/vim/commit/55c77cf2ea9c15e1ec75d1faf702ec3c9e325271 --- src/nvim/buffer.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/nvim/buffer.c') diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 1daedb90b5..cc9f130bfc 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -1956,10 +1956,7 @@ void free_buf_options(buf_T *buf, int free_p_ff) } buf->b_p_vsts_array = NULL; clear_string_option(&buf->b_p_vts); - if (buf->b_p_vts_array) { - xfree(buf->b_p_vts_array); - } - buf->b_p_vts_array = NULL; + XFREE_CLEAR(buf->b_p_vts_array); clear_string_option(&buf->b_p_keymap); keymap_ga_clear(&buf->b_kmap_ga); ga_clear(&buf->b_kmap_ga); -- cgit