mirror of
https://github.com/neovim/neovim.git
synced 2026-07-30 20:38:03 +00:00
feat: add 'mousescroll' option (#12355)
Add 'mousescroll' option to control how many lines to scroll by when a
mouse wheel keycode is received. The mousescroll option controls both
horizontal and vertical scrolling. The option is a string in the format:
set mousescroll=direction:count,direction:count
Where direction is either "ver" or "hor", and count is a non negative
integer. If a direction is omitted, a default value is used. The default
values remain unchanged, that is 3 for vertical scrolling, and 6 for
horizontal scrolling. As such, the mousescroll default is "ver:3,hor:6".
Add mousescroll documentation
- Add option documentation in options.txt
- Add brief summary in quickref.txt
Update :help scroll-mouse-wheel
- Mention mousescroll option as a means of controlling scrolling.
- Remove obsolete suggestion to map scroll wheel keys to <C-U> to
scroll by a single line -- users should prefer the mousescroll option.
- Add some information about the consequences of remapping scroll wheel
keys (they lose their magic ability to affect inactive windows).
Update :help vim-differences
- Add brief mousescroll summary under Options
Add mousescroll tests
- Test option validation
- Test default mousescroll value and behavior
- Test fallback to default values
- Test mouse vertical and horizontal scrolling in normal mode
- Test mouse vertical and horizontal scrolling in insert mode
This commit is contained in:
@@ -8557,14 +8557,12 @@ static void ins_mousescroll(int dir)
|
||||
}
|
||||
|
||||
// Don't scroll the window in which completion is being done.
|
||||
if (!pum_visible()
|
||||
|| curwin != old_curwin) {
|
||||
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));
|
||||
scroll_redraw(dir, (long)(curwin->w_botline - curwin->w_topline));
|
||||
} else {
|
||||
scroll_redraw(dir, 3L);
|
||||
scroll_redraw(dir, p_mousescroll_vert);
|
||||
}
|
||||
} else {
|
||||
mouse_scroll_horiz(dir);
|
||||
|
||||
Reference in New Issue
Block a user