aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-10-24 20:05:02 +0200
committerGitHub <noreply@github.com>2022-10-24 20:05:02 +0200
commit40791f8e8239dcb4dda1c4d61e2aa9088e75bb17 (patch)
tree19faf6122ba957b2488956132621df04ae8fe601
parent6da2271a04540f6f3bd6d3cae1895bb1ea1b5011 (diff)
parenta53998ae78902309c225b323e0b8d9f1f75fe147 (diff)
downloadrneovim-40791f8e8239dcb4dda1c4d61e2aa9088e75bb17.tar.gz
rneovim-40791f8e8239dcb4dda1c4d61e2aa9088e75bb17.tar.bz2
rneovim-40791f8e8239dcb4dda1c4d61e2aa9088e75bb17.zip
Merge pull request #20775 from shadmansaleh/fix/opt_tal_not_redrawing_tabline
fix: setting tabline option not redrawing tabline
-rw-r--r--src/nvim/generators/gen_options.lua1
-rw-r--r--src/nvim/option.c4
-rw-r--r--src/nvim/option_defs.h1
-rw-r--r--src/nvim/options.lua4
-rw-r--r--test/functional/ui/tabline_spec.lua36
5 files changed, 44 insertions, 2 deletions
diff --git a/src/nvim/generators/gen_options.lua b/src/nvim/generators/gen_options.lua
index 6dba6552b3..4e4dd83367 100644
--- a/src/nvim/generators/gen_options.lua
+++ b/src/nvim/generators/gen_options.lua
@@ -30,6 +30,7 @@ local type_flags={
local redraw_flags={
statuslines='P_RSTAT',
+ tabline = 'P_RTABL',
current_window='P_RWIN',
current_window_only='P_RWINONLY',
current_buffer='P_RBUF',
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 1a6cd0c1af..06662afd08 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -2648,6 +2648,10 @@ void check_redraw(uint32_t flags)
status_redraw_all();
}
+ if ((flags & P_RTABL) || all) { // mark tablines dirty
+ redraw_tabline = true;
+ }
+
if ((flags & P_RBUF) || (flags & P_RWIN) || all) {
changed_window_setting();
}
diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h
index c4333a6f61..19e4780e0a 100644
--- a/src/nvim/option_defs.h
+++ b/src/nvim/option_defs.h
@@ -24,6 +24,7 @@
#define P_NO_MKRC 0x200U ///< don't include in :mkvimrc output
// when option changed, what to display:
+#define P_RTABL 0x800U ///< redraw tabline
#define P_RSTAT 0x1000U ///< redraw status lines
#define P_RWIN 0x2000U ///< redraw current window and recompute text
#define P_RBUF 0x4000U ///< redraw current buffer and recompute text
diff --git a/src/nvim/options.lua b/src/nvim/options.lua
index 8a883a09c3..ba483d3714 100644
--- a/src/nvim/options.lua
+++ b/src/nvim/options.lua
@@ -19,7 +19,7 @@
-- types: bool, number, string
-- lists: (nil), comma, onecomma, flags, flagscomma
-- scopes: global, buffer, window
--- redraw options: statuslines, current_window, curent_window_only,
+-- redraw options: statuslines, tabline, current_window, curent_window_only,
-- current_buffer, all_windows, curswant
-- defaults: {condition=#if condition, if_true=default, if_false=default}
-- #if condition:
@@ -2407,7 +2407,7 @@ return {
short_desc=N_("custom format for the console tab pages line"),
type='string', scope={'global'},
modelineexpr=true,
- redraw={'statuslines'},
+ redraw={'tabline'},
varname='p_tal',
defaults={if_true=""}
},
diff --git a/test/functional/ui/tabline_spec.lua b/test/functional/ui/tabline_spec.lua
index 809486d4db..0e35a03557 100644
--- a/test/functional/ui/tabline_spec.lua
+++ b/test/functional/ui/tabline_spec.lua
@@ -84,3 +84,39 @@ describe('ui/ext_tabline', function()
end}
end)
end)
+
+describe("tabline", function()
+ local screen
+
+ before_each(function()
+ clear()
+ screen = Screen.new(42, 5)
+ screen:attach()
+ end)
+
+ it('redraws when tabline option is set', function()
+ command('set tabline=asdf')
+ command('set showtabline=2')
+ screen:expect{grid=[[
+ {1:asdf }|
+ ^ |
+ {2:~ }|
+ {2:~ }|
+ |
+ ]], attr_ids={
+ [1] = {reverse = true};
+ [2] = {bold = true, foreground = Screen.colors.Blue1};
+ }}
+ command('set tabline=jkl')
+ screen:expect{grid=[[
+ {1:jkl }|
+ ^ |
+ {2:~ }|
+ {2:~ }|
+ |
+ ]], attr_ids={
+ [1] = {reverse = true};
+ [2] = {bold = true, foreground = Screen.colors.Blue};
+ }}
+ end)
+end)