diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-08-21 15:23:32 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-21 15:23:32 +0800 |
commit | cc35352f65f823259675f84a915ee03d2423913e (patch) | |
tree | a84e8e856d9642e89c08a37b984dc2a3ecaf5ab0 /src/nvim/edit.c | |
parent | 3b0515e674f279d6504a0fc055808cdf01eead99 (diff) | |
download | rneovim-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/edit.c')
-rw-r--r-- | src/nvim/edit.c | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index d980699162..915399ec78 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -3995,82 +3995,6 @@ static bool ins_bs(int c, int mode, int *inserted_space_p) return did_backspace; } -static void ins_mouse(int c) -{ - pos_T tpos; - win_T *old_curwin = curwin; - - undisplay_dollar(); - tpos = curwin->w_cursor; - if (do_mouse(NULL, c, BACKWARD, 1, 0)) { - win_T *new_curwin = curwin; - - if (curwin != old_curwin && win_valid(old_curwin)) { - // Mouse took us to another window. We need to go back to the - // previous one to stop insert there properly. - curwin = old_curwin; - curbuf = curwin->w_buffer; - if (bt_prompt(curbuf)) { - // Restart Insert mode when re-entering the prompt buffer. - curbuf->b_prompt_insert = 'A'; - } - } - start_arrow(curwin == old_curwin ? &tpos : NULL); - if (curwin != new_curwin && win_valid(new_curwin)) { - curwin = new_curwin; - curbuf = curwin->w_buffer; - } - can_cindent = true; - } - - // redraw status lines (in case another window became active) - redraw_statuslines(); -} - -static void ins_mousescroll(int dir) -{ - win_T *const old_curwin = curwin; - pos_T tpos = curwin->w_cursor; - - if (mouse_row >= 0 && mouse_col >= 0) { - int row = mouse_row, col = mouse_col, grid = mouse_grid; - - // 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 (curwin == old_curwin) { - undisplay_dollar(); - } - - // Don't scroll the window in which completion is being done. - if (!pum_visible() || curwin != old_curwin) { - if (dir == MSCR_DOWN || dir == MSCR_UP) { - if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) { - scroll_redraw(dir, curwin->w_botline - curwin->w_topline); - } else if (p_mousescroll_vert > 0) { - scroll_redraw(dir, (linenr_T)p_mousescroll_vert); - } - } else { - mouse_scroll_horiz(dir); - } - } - - curwin->w_redr_status = true; - - curwin = old_curwin; - curbuf = curwin->w_buffer; - - if (!equalpos(curwin->w_cursor, tpos)) { - start_arrow(&tpos); - can_cindent = true; - } -} - static void ins_left(void) { pos_T tpos; |