diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2016-09-12 03:43:07 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-09-12 03:43:07 +0200 |
commit | 2daf54ee8dd92accdbc53aa7fb430134072e73e9 (patch) | |
tree | e1684d7e82bc02d9a985a7ab58b34c995e02922b /src | |
parent | b801291becd19cd462d683dd3f14b71572c02621 (diff) | |
parent | ac819b8994079d78fdafb883e6e6144dd9aa952f (diff) | |
download | rneovim-2daf54ee8dd92accdbc53aa7fb430134072e73e9.tar.gz rneovim-2daf54ee8dd92accdbc53aa7fb430134072e73e9.tar.bz2 rneovim-2daf54ee8dd92accdbc53aa7fb430134072e73e9.zip |
Merge #4874 'Restore vim-like tab dragging'
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/normal.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c index c95e5e1a15..4dec51ce83 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -2110,6 +2110,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 +2360,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 +2475,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; } |