aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2018-10-18 19:06:21 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2018-12-31 12:44:22 +0100
commitc3e2e40e028b66495a866785afaf1a6d7e5b3a3b (patch)
tree21ba5da172f5b708d941df518cd61fbedeb87826
parentebe16cd9bdd214955469f4db4f1c4a2c11724b1d (diff)
downloadrneovim-c3e2e40e028b66495a866785afaf1a6d7e5b3a3b.tar.gz
rneovim-c3e2e40e028b66495a866785afaf1a6d7e5b3a3b.tar.bz2
rneovim-c3e2e40e028b66495a866785afaf1a6d7e5b3a3b.zip
multigrid: send win_hide events when changing tabpage
-rw-r--r--src/nvim/api/ui_events.in.h4
-rw-r--r--src/nvim/window.c33
2 files changed, 33 insertions, 4 deletions
diff --git a/src/nvim/api/ui_events.in.h b/src/nvim/api/ui_events.in.h
index 308d5aaf02..48e43061c6 100644
--- a/src/nvim/api/ui_events.in.h
+++ b/src/nvim/api/ui_events.in.h
@@ -85,7 +85,9 @@ void grid_destroy(Integer grid)
FUNC_API_SINCE(5) FUNC_API_REMOTE_ONLY;
void win_position(Integer win, Integer grid, Integer startrow,
Integer startcol, Integer width, Integer height)
- FUNC_API_SINCE(4) FUNC_API_REMOTE_ONLY;
+ FUNC_API_SINCE(5) FUNC_API_REMOTE_ONLY;
+void win_hide(Integer win, Integer grid)
+ FUNC_API_SINCE(5) FUNC_API_REMOTE_ONLY;
void popupmenu_show(Array items, Integer selected,
Integer row, Integer col, Integer grid)
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 30ee4c6303..5fa33e618c 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -3118,6 +3118,10 @@ int win_new_tabpage(int after, char_u *filename)
redraw_all_later(NOT_VALID);
+ if (ui_is_external(kUIMultigrid)) {
+ tabpage_check_windows(tp);
+ }
+
apply_autocmds(EVENT_WINNEW, NULL, NULL, false, curbuf);
apply_autocmds(EVENT_WINENTER, NULL, NULL, false, curbuf);
apply_autocmds(EVENT_TABNEW, filename, filename, false, curbuf);
@@ -3309,11 +3313,16 @@ static void enter_tabpage(tabpage_T *tp, buf_T *old_curbuf, int trigger_enter_au
int old_off = tp->tp_firstwin->w_winrow;
win_T *next_prevwin = tp->tp_prevwin;
+ tabpage_T *old_curtab = curtab;
curtab = tp;
firstwin = tp->tp_firstwin;
lastwin = tp->tp_lastwin;
topframe = tp->tp_topframe;
+ if (old_curtab != curtab && ui_is_external(kUIMultigrid)) {
+ tabpage_check_windows(old_curtab);
+ }
+
/* We would like doing the TabEnter event first, but we don't have a
* valid current window yet, which may break some commands.
* This triggers autocommands, thus may make "tp" invalid. */
@@ -3349,6 +3358,20 @@ static void enter_tabpage(tabpage_T *tp, buf_T *old_curbuf, int trigger_enter_au
must_redraw = NOT_VALID;
}
+/// called when changing current tabpage from old_curtab to curtab
+static void tabpage_check_windows(tabpage_T *old_curtab)
+{
+ win_T *next_wp;
+ for (win_T *wp = old_curtab->tp_firstwin; wp; wp = next_wp) {
+ next_wp = wp->w_next;
+ wp->w_pos_changed = true;
+ }
+
+ for (win_T *wp = firstwin; wp; wp = wp->w_next) {
+ wp->w_pos_changed = true;
+ }
+}
+
/*
* Go to tab page "n". For ":tab N" and "Ngt".
* When "n" is 9999 go to the last tab page.
@@ -6074,10 +6097,14 @@ void win_ui_flush(void)
return;
}
- FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
+ FOR_ALL_TAB_WINDOWS(tp, wp) {
if (wp->w_pos_changed && wp->w_grid.ScreenLines != NULL) {
- ui_call_win_position(wp->handle, wp->w_grid.handle, wp->w_winrow,
- wp->w_wincol, wp->w_width, wp->w_height);
+ if (tp == curtab) {
+ ui_call_win_position(wp->handle, wp->w_grid.handle, wp->w_winrow,
+ wp->w_wincol, wp->w_width, wp->w_height);
+ } else {
+ ui_call_win_hide(wp->handle, wp->w_grid.handle);
+ }
wp->w_pos_changed = false;
}
}