mirror of git://git.sv.gnu.org/nano.git
input: scroll on mousewheel events instead of moving the cursor
Translate mousewheel events into Alt+Up/Down key presses instead of into plain Up/Down key presses, as the latter only start scrolling once the cursor reaches the top or bottom. Scrolling rather than moving the cursor is the standard behavior for mousewheel events in GUI editors such as Gedit and Kate, as well as in the mouse mode of terminal editors such as vim, joe, and mcedit. Signed-off-by: Andy Koppe <andy.koppe@gmail.com>
This commit is contained in:
parent
f1a04f780a
commit
4673e709b2
|
@ -1584,9 +1584,9 @@ char *get_verbatim_kbinput(WINDOW *frame, size_t *count)
|
|||
* TRUE, releasing/clicking on a visible shortcut will put back the
|
||||
* keystroke associated with that shortcut. If ncurses supports them,
|
||||
* we also handle presses of the fourth mouse button (upward rolls of
|
||||
* the mouse wheel) by putting back keystrokes to move up, and presses
|
||||
* the mouse wheel) by putting back keystrokes to scroll up, and presses
|
||||
* of the fifth mouse button (downward rolls of the mouse wheel) by
|
||||
* putting back keystrokes to move down. We also store the coordinates
|
||||
* putting back keystrokes to scroll down. We also store the coordinates
|
||||
* of a mouse event that needs further handling in mouse_x and mouse_y.
|
||||
* Return -1 on error, 0 if the mouse event needs to be handled, 1 if it's
|
||||
* been handled by putting back keystrokes, or 2 if it's been ignored. */
|
||||
|
@ -1684,9 +1684,9 @@ int get_mouseinput(int *mouse_y, int *mouse_x, bool allow_shortcuts)
|
|||
wmouse_trafo(footwin, mouse_y, mouse_x, FALSE);
|
||||
|
||||
if (in_middle || (in_footer && *mouse_y == 0)) {
|
||||
int keycode = (event.bstate & BUTTON4_PRESSED) ? KEY_UP : KEY_DOWN;
|
||||
int keycode = (event.bstate & BUTTON4_PRESSED) ? ALT_UP : ALT_DOWN;
|
||||
|
||||
/* One roll of the mouse wheel should move three lines. */
|
||||
/* One roll of the mouse wheel should scroll three lines. */
|
||||
for (int count = 3; count > 0; count--)
|
||||
put_back(keycode);
|
||||
|
||||
|
|
Loading…
Reference in New Issue