]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.1.0706: tabline is not always redrawn v8.1.0706
authorBram Moolenaar <Bram@vim.org>
Tue, 8 Jan 2019 21:02:56 +0000 (22:02 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 8 Jan 2019 21:02:56 +0000 (22:02 +0100)
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.

runtime/doc/options.txt
runtime/doc/various.txt
src/ex_cmdidxs.h
src/ex_cmds.h
src/ex_docmd.c
src/proto/screen.pro
src/screen.c
src/testdir/test_tabline.vim
src/version.c

index 60f01de33806877c8f134973c1cfd0b0c6dab302..008926f63e12dc1f3b262de28c525fda838ebe87 100644 (file)
@@ -7758,6 +7758,9 @@ A jump table for the options with a short description can be found at |Q_op|.
        the text to be displayed.  Use "%1T" for the first label, "%2T" for
        the second one, etc.  Use "%X" items for closing labels.
 
+       When changing something that is used in 'tabline' that does not
+       trigger it to be updated, use |:redrawtabline|.
+
        Keep in mind that only one of the tab pages is the current one, others
        are invisible and you can't jump to their windows.
 
index 67acc645fc2a8a0b88ecade3824192d0c73c03b0..37b7074a1d7f6b5884ccff2b4139fe0008164da2 100644 (file)
@@ -1,4 +1,4 @@
-*various.txt*   For Vim version 8.1.  Last change: 2018 Dec 13
+*various.txt*   For Vim version 8.1.  Last change: 2019 Jan 08
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -30,6 +30,11 @@ CTRL-L                       Clear and redraw the screen.  The redraw may happen
                        includes an item that doesn't cause automatic
                        updating.
 
+                                               *:redrawt* *:redrawtabline*
+:redrawt[abline]       Redraw the tabline.  Useful to update the tabline when
+                       'tabline' includes an item that doesn't trigger
+                       automatic updating.
+
                                                        *N<Del>*
 <Del>                  When entering a number: Remove the last digit.
                        Note: if you like to use <BS> for this, add this
index 1c435caea8761fc445ea0212eacafc798eec4454..8b7c85c0ceb3b8d0c36b9d6a2e91c9eee15ceb09 100644 (file)
@@ -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;
index 49e7fc75d05c4d954f1de3d99375b49ece5ce8a8..6bb930cf2356958f7229c6f80c9cd2a93d0d925b 100644 (file)
@@ -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),
index aad818294ed1611701f4a766536ccaae6ebd6417..354cc119b6c84b47fc7646fb123698f23464c345 100644 (file)
@@ -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)
 {
index 7a10e3be52e7ec8e52d9c55a2194c6b1d3df4b37..552453ad8dc35d8208e459005e63fa0c36954d34 100644 (file)
@@ -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);
index e9405b4f8e16344ef3f25921fbcc6efe88fa6a1f..04f19d7acd32a529ebd527637adbcb4ef31018fd 100644 (file)
@@ -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;
index b08f299fd023e995c38c95336542dac8845dd920..383d23984cf2bde107902b3e4802df795b322c8e 100644 (file)
@@ -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
index e772d05b209a43ad04456b04d15b31e9b6013ee9..768c384c645dcb69898220ddf53cc26ba3eb6fd7 100644 (file)
@@ -799,6 +799,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    706,
 /**/
     705,
 /**/