aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/normal.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r--src/nvim/normal.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index c95e5e1a15..d0a9d3aca7 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -36,7 +36,6 @@
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/misc1.h"
-#include "nvim/misc2.h"
#include "nvim/keymap.h"
#include "nvim/move.h"
#include "nvim/mouse.h"
@@ -2110,6 +2109,20 @@ static void op_function(oparg_T *oap)
}
}
+// Move the current tab to tab in same column as mouse or to end of the
+// tabline if there is no tab there.
+static void move_tab_to_mouse(void)
+{
+ int tabnr = tab_page_click_defs[mouse_col].tabnr;
+ if (tabnr <= 0) {
+ tabpage_move(9999);
+ } else if (tabnr < tabpage_index(curtab)) {
+ tabpage_move(tabnr - 1);
+ } else {
+ tabpage_move(tabnr);
+ }
+}
+
/*
* Do the appropriate action for the current mouse click in the current mode.
* Not used for Command-line mode.
@@ -2346,12 +2359,7 @@ do_mouse (
if (mouse_row == 0 && firstwin->w_winrow > 0) {
if (is_drag) {
if (in_tab_line) {
- if (tab_page_click_defs[mouse_col].type == kStlClickTabClose) {
- tabpage_move(9999);
- } else {
- int tabnr = tab_page_click_defs[mouse_col].tabnr;
- tabpage_move(tabnr < tabpage_index(curtab) ? tabnr - 1 : tabnr);
- }
+ move_tab_to_mouse();
}
return false;
}
@@ -2466,10 +2474,7 @@ do_mouse (
}
return true;
} else if (is_drag && in_tab_line) {
- tabpage_move(tab_page_click_defs[mouse_col].type == kStlClickTabClose
- ? 9999
- : tab_page_click_defs[mouse_col].tabnr - 1);
- in_tab_line = false;
+ move_tab_to_mouse();
return false;
}
@@ -5919,6 +5924,9 @@ static void nv_replace(cmdarg_T *cap)
curwin->w_set_curswant = true;
set_last_insert(cap->nchar);
}
+
+ foldUpdateAll(curwin);
+ foldOpenCursor();
}
/*