summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-01-08 22:02:56 +0100
committerBram Moolenaar <Bram@vim.org>2019-01-08 22:02:56 +0100
commite12bab3144af8943937bd0ff4bc57f04e53037b3 (patch)
tree4eab96cbe0a9f126f971d85dce929537371109e2 /src
parent6d4470b0e9aac76ae43be27a28447ea29767d77f (diff)
patch 8.1.0706: tabline is not always redrawnv8.1.0706
Problem: Tabline is not always redrawn when something that is used in 'tabline' changes. Solution: Add ":redrawtabline" so that a plugin can at least cause the redraw when needed.
Diffstat (limited to 'src')
-rw-r--r--src/ex_cmdidxs.h20
-rw-r--r--src/ex_cmds.h3
-rw-r--r--src/ex_docmd.c20
-rw-r--r--src/proto/screen.pro1
-rw-r--r--src/screen.c3
-rw-r--r--src/testdir/test_tabline.vim39
-rw-r--r--src/version.c2
7 files changed, 68 insertions, 20 deletions
diff --git a/src/ex_cmdidxs.h b/src/ex_cmdidxs.h
index 1c435caea8..8b7c85c0ce 100644
--- a/src/ex_cmdidxs.h
+++ b/src/ex_cmdidxs.h
@@ -23,14 +23,14 @@ static const unsigned short cmdidxs1[26] =
/* p */ 309,
/* q */ 348,
/* r */ 351,
- /* s */ 370,
- /* t */ 437,
- /* u */ 480,
- /* v */ 491,
- /* w */ 509,
- /* x */ 524,
- /* y */ 533,
- /* z */ 534
+ /* s */ 371,
+ /* t */ 438,
+ /* u */ 481,
+ /* v */ 492,
+ /* w */ 510,
+ /* x */ 525,
+ /* y */ 534,
+ /* z */ 535
};
/*
@@ -58,7 +58,7 @@ static const unsigned char cmdidxs2[26][26] =
/* o */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 5, 0, 0, 0, 0, 0, 0, 9, 0, 11, 0, 0, 0 },
/* p */ { 1, 0, 3, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 16, 17, 26, 0, 27, 0, 28, 0 },
/* q */ { 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
- /* r */ { 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 18, 0, 0, 0, 0 },
+ /* r */ { 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 19, 0, 0, 0, 0 },
/* s */ { 2, 6, 15, 0, 18, 22, 0, 24, 25, 0, 0, 28, 30, 34, 38, 40, 0, 48, 0, 49, 0, 61, 62, 0, 63, 0 },
/* t */ { 2, 0, 19, 0, 22, 24, 0, 25, 0, 26, 0, 27, 31, 34, 36, 37, 0, 38, 40, 0, 41, 0, 0, 0, 0, 0 },
/* u */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
@@ -69,4 +69,4 @@ static const unsigned char cmdidxs2[26][26] =
/* z */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
-static const int command_count = 547;
+static const int command_count = 548;
diff --git a/src/ex_cmds.h b/src/ex_cmds.h
index 49e7fc75d0..6bb930cf23 100644
--- a/src/ex_cmds.h
+++ b/src/ex_cmds.h
@@ -1175,6 +1175,9 @@ EX(CMD_redraw, "redraw", ex_redraw,
EX(CMD_redrawstatus, "redrawstatus", ex_redrawstatus,
BANG|TRLBAR|CMDWIN,
ADDR_LINES),
+EX(CMD_redrawtabline, "redrawtabline", ex_redrawtabline,
+ TRLBAR|CMDWIN,
+ ADDR_LINES),
EX(CMD_registers, "registers", ex_display,
EXTRA|NOTRLCOM|TRLBAR|CMDWIN,
ADDR_LINES),
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index aad818294e..354cc119b6 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -296,6 +296,7 @@ static void ex_redo(exarg_T *eap);
static void ex_later(exarg_T *eap);
static void ex_redir(exarg_T *eap);
static void ex_redrawstatus(exarg_T *eap);
+static void ex_redrawtabline(exarg_T *eap);
static void close_redir(void);
static void ex_mkrc(exarg_T *eap);
static void ex_mark(exarg_T *eap);
@@ -9918,6 +9919,25 @@ ex_redrawstatus(exarg_T *eap UNUSED)
out_flush();
}
+/*
+ * ":redrawtabline": force redraw of the tabline
+ */
+ static void
+ex_redrawtabline(exarg_T *eap UNUSED)
+{
+ int r = RedrawingDisabled;
+ int p = p_lz;
+
+ RedrawingDisabled = 0;
+ p_lz = FALSE;
+
+ draw_tabline();
+
+ RedrawingDisabled = r;
+ p_lz = p;
+ out_flush();
+}
+
static void
close_redir(void)
{
diff --git a/src/proto/screen.pro b/src/proto/screen.pro
index 7a10e3be52..552453ad8d 100644
--- a/src/proto/screen.pro
+++ b/src/proto/screen.pro
@@ -52,6 +52,7 @@ int screen_del_lines(int off, int row, int line_count, int end, int force, int c
int showmode(void);
void unshowmode(int force);
void clearmode(void);
+void draw_tabline(void);
void get_trans_bufname(buf_T *buf);
int redrawing(void);
int messaging(void);
diff --git a/src/screen.c b/src/screen.c
index e9405b4f8e..04f19d7acd 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -154,7 +154,6 @@ static int win_do_lines(win_T *wp, int row, int line_count, int mayclear, int de
static void win_rest_invalid(win_T *wp);
static void msg_pos_mode(void);
static void recording_mode(int attr);
-static void draw_tabline(void);
static int fillchar_status(int *attr, win_T *wp);
static int fillchar_vsep(int *attr);
#ifdef FEAT_MENU
@@ -10693,7 +10692,7 @@ recording_mode(int attr)
/*
* Draw the tab pages line at the top of the Vim window.
*/
- static void
+ void
draw_tabline(void)
{
int tabcount = 0;
diff --git a/src/testdir/test_tabline.vim b/src/testdir/test_tabline.vim
index b08f299fd0..383d23984c 100644
--- a/src/testdir/test_tabline.vim
+++ b/src/testdir/test_tabline.vim
@@ -1,19 +1,22 @@
-function! TablineWithCaughtError()
+
+source shared.vim
+
+func TablineWithCaughtError()
let s:func_in_tabline_called = 1
try
call eval('unknown expression')
catch
endtry
return ''
-endfunction
+endfunc
-function! TablineWithError()
+func TablineWithError()
let s:func_in_tabline_called = 1
call eval('unknown expression')
return ''
-endfunction
+endfunc
-function! Test_caught_error_in_tabline()
+func Test_caught_error_in_tabline()
if has('gui')
set guioptions-=e
endif
@@ -27,9 +30,9 @@ function! Test_caught_error_in_tabline()
call assert_equal(tabline, &tabline)
set tabline=
let &showtabline = showtabline_save
-endfunction
+endfunc
-function! Test_tabline_will_be_disabled_with_error()
+func Test_tabline_will_be_disabled_with_error()
if has('gui')
set guioptions-=e
endif
@@ -46,4 +49,24 @@ function! Test_tabline_will_be_disabled_with_error()
call assert_equal('', &tabline)
set tabline=
let &showtabline = showtabline_save
-endfunction
+endfunc
+
+func Test_redrawtabline()
+ if has('gui')
+ set guioptions-=e
+ endif
+ let showtabline_save = &showtabline
+ set showtabline=2
+ set tabline=%{bufnr('$')}
+ edit Xtabline1
+ edit Xtabline2
+ redraw
+ call assert_match(bufnr('$') . '', Screenline(1))
+ au BufAdd * redrawtabline
+ badd Xtabline3
+ call assert_match(bufnr('$') . '', Screenline(1))
+
+ set tabline=
+ let &showtabline = showtabline_save
+ au! Bufadd
+endfunc
diff --git a/src/version.c b/src/version.c
index e772d05b20..768c384c64 100644
--- a/src/version.c
+++ b/src/version.c
@@ -800,6 +800,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 706,
+/**/
705,
/**/
704,