summaryrefslogtreecommitdiffstats
path: root/src/edit.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2010-07-25 15:49:07 +0200
committerBram Moolenaar <Bram@vim.org>2010-07-25 15:49:07 +0200
commit8d9b40e71ab62f43c65a52225cb833ecc0d1bf6b (patch)
treea25e59faa9adfd7e352c407ded5beedf4242d1d2 /src/edit.c
parent0fe849a13b4c0753d6b2424783879696a1fd4421 (diff)
Add support for horizontal scroll wheel. (Bjorn Winckler)
Diffstat (limited to 'src/edit.c')
-rw-r--r--src/edit.c46
1 files changed, 36 insertions, 10 deletions
diff --git a/src/edit.c b/src/edit.c
index 3370a28f2d..4754fd9bde 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -224,7 +224,7 @@ static void ins_del __ARGS((void));
static int ins_bs __ARGS((int c, int mode, int *inserted_space_p));
#ifdef FEAT_MOUSE
static void ins_mouse __ARGS((int c));
-static void ins_mousescroll __ARGS((int up));
+static void ins_mousescroll __ARGS((int dir));
#endif
#if defined(FEAT_GUI_TABLINE) || defined(PROTO)
static void ins_tabline __ARGS((int c));
@@ -1112,11 +1112,19 @@ doESCkey:
break;
case K_MOUSEDOWN: /* Default action for scroll wheel up: scroll up */
- ins_mousescroll(FALSE);
+ ins_mousescroll(MSCR_DOWN);
break;
case K_MOUSEUP: /* Default action for scroll wheel down: scroll down */
- ins_mousescroll(TRUE);
+ ins_mousescroll(MSCR_UP);
+ break;
+
+ case K_MOUSELEFT: /* Scroll wheel left */
+ ins_mousescroll(MSCR_LEFT);
+ break;
+
+ case K_MOUSERIGHT: /* Scroll wheel right */
+ ins_mousescroll(MSCR_RIGHT);
break;
#endif
#ifdef FEAT_GUI_TABLINE
@@ -3516,7 +3524,8 @@ ins_compl_prep(c)
edit_submode_extra = NULL;
/* Ignore end of Select mode mapping and mouse scroll buttons. */
- if (c == K_SELECT || c == K_MOUSEDOWN || c == K_MOUSEUP)
+ if (c == K_SELECT || c == K_MOUSEDOWN || c == K_MOUSEUP
+ || c == K_MOUSELEFT || c == K_MOUSERIGHT)
return retval;
/* Set "compl_get_longest" when finding the first matches. */
@@ -8859,8 +8868,8 @@ ins_mouse(c)
}
static void
-ins_mousescroll(up)
- int up;
+ins_mousescroll(dir)
+ int dir;
{
pos_T tpos;
# if defined(FEAT_WINDOWS)
@@ -8898,10 +8907,27 @@ ins_mousescroll(up)
)
# endif
{
- if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL))
- scroll_redraw(up, (long)(curwin->w_botline - curwin->w_topline));
+ if (dir == MSCR_DOWN || dir == MSCR_UP)
+ {
+ if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL))
+ scroll_redraw(dir,
+ (long)(curwin->w_botline - curwin->w_topline));
+ else
+ scroll_redraw(dir, 3L);
+ }
+#ifdef FEAT_GUI
else
- scroll_redraw(up, 3L);
+ {
+ int val, step = 6;
+
+ if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL))
+ step = W_WIDTH(curwin);
+ val = curwin->w_leftcol + (dir == MSCR_RIGHT ? -step : step);
+ if (val < 0)
+ val = 0;
+ gui_do_horiz_scroll(val, TRUE);
+ }
+#endif
# ifdef FEAT_INS_EXPAND
did_scroll = TRUE;
# endif
@@ -8985,7 +9011,7 @@ ins_horscroll()
undisplay_dollar();
tpos = curwin->w_cursor;
- if (gui_do_horiz_scroll())
+ if (gui_do_horiz_scroll(scrollbar_value, FALSE))
{
start_arrow(&tpos);
# ifdef FEAT_CINDENT