aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/normal.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-08-21 15:23:32 +0800
committerGitHub <noreply@github.com>2023-08-21 15:23:32 +0800
commitcc35352f65f823259675f84a915ee03d2423913e (patch)
treea84e8e856d9642e89c08a37b984dc2a3ecaf5ab0 /src/nvim/normal.c
parent3b0515e674f279d6504a0fc055808cdf01eead99 (diff)
downloadrneovim-cc35352f65f823259675f84a915ee03d2423913e.tar.gz
rneovim-cc35352f65f823259675f84a915ee03d2423913e.tar.bz2
rneovim-cc35352f65f823259675f84a915ee03d2423913e.zip
vim-patch:8.1.2062: the mouse code is spread out (#24817)
Problem: The mouse code is spread out. Solution: Move all the mouse code to mouse.c. (Yegappan Lakshmanan, closes vim/vim#4959) https://github.com/vim/vim/commit/b20b9e14ddd8db111e886ad0494e15b955159426 Also move getmousepos() there. N/A patches for version.c: vim-patch:8.1.2070: mouse code is spread out Problem: Mouse code is spread out. Solution: Move mouse terminal code parsing to mouse.c. (Yegappan Lakshmanan, closes vim/vim#4966) https://github.com/vim/vim/commit/b8ff5c271ee5dcef6f63436b77e228e062ff9a0e Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r--src/nvim/normal.c53
1 files changed, 1 insertions, 52 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 40bef6b580..a6f64d22ce 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -2615,60 +2615,9 @@ static bool nv_screengo(oparg_T *oap, int dir, long dist)
return retval;
}
-/// Mouse scroll wheel: Default action is to scroll three lines, or one page
-/// when Shift or Ctrl is used.
-/// K_MOUSEUP (cap->arg == 1) or K_MOUSEDOWN (cap->arg == 0) or
-/// K_MOUSELEFT (cap->arg == -1) or K_MOUSERIGHT (cap->arg == -2)
-static void nv_mousescroll(cmdarg_T *cap)
-{
- win_T *old_curwin = curwin;
-
- if (mouse_row >= 0 && mouse_col >= 0) {
- int grid, row, col;
-
- grid = mouse_grid;
- row = mouse_row;
- col = mouse_col;
-
- // find the window at the pointer coordinates
- win_T *wp = mouse_find_win(&grid, &row, &col);
- if (wp == NULL) {
- return;
- }
- curwin = wp;
- curbuf = curwin->w_buffer;
- }
-
- if (cap->arg == MSCR_UP || cap->arg == MSCR_DOWN) {
- if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) {
- (void)onepage(cap->arg ? FORWARD : BACKWARD, 1);
- } else if (p_mousescroll_vert > 0) {
- cap->count1 = (int)p_mousescroll_vert;
- cap->count0 = (int)p_mousescroll_vert;
- nv_scroll_line(cap);
- }
- } else {
- mouse_scroll_horiz(cap->arg);
- }
- if (curwin != old_curwin && curwin->w_p_cul) {
- redraw_for_cursorline(curwin);
- }
-
- curwin->w_redr_status = true;
-
- curwin = old_curwin;
- curbuf = curwin->w_buffer;
-}
-
-/// Mouse clicks and drags.
-static void nv_mouse(cmdarg_T *cap)
-{
- (void)do_mouse(cap->oap, cap->cmdchar, BACKWARD, cap->count1, 0);
-}
-
/// Handle CTRL-E and CTRL-Y commands: scroll a line up or down.
/// cap->arg must be true for CTRL-E.
-static void nv_scroll_line(cmdarg_T *cap)
+void nv_scroll_line(cmdarg_T *cap)
{
if (!checkclearop(cap->oap)) {
scroll_redraw(cap->arg, cap->count1);