comparison src/edit.c @ 2409:0ca06a92adfb vim73

Add support for horizontal scroll wheel. (Bjorn Winckler)
author Bram Moolenaar <bram@vim.org>
date Sun, 25 Jul 2010 15:49:07 +0200
parents 85b7dc8da5eb
children 33148c37f3c9
comparison
equal deleted inserted replaced
2408:9e2e63af1641 2409:0ca06a92adfb
222 static void ins_shift __ARGS((int c, int lastc)); 222 static void ins_shift __ARGS((int c, int lastc));
223 static void ins_del __ARGS((void)); 223 static void ins_del __ARGS((void));
224 static int ins_bs __ARGS((int c, int mode, int *inserted_space_p)); 224 static int ins_bs __ARGS((int c, int mode, int *inserted_space_p));
225 #ifdef FEAT_MOUSE 225 #ifdef FEAT_MOUSE
226 static void ins_mouse __ARGS((int c)); 226 static void ins_mouse __ARGS((int c));
227 static void ins_mousescroll __ARGS((int up)); 227 static void ins_mousescroll __ARGS((int dir));
228 #endif 228 #endif
229 #if defined(FEAT_GUI_TABLINE) || defined(PROTO) 229 #if defined(FEAT_GUI_TABLINE) || defined(PROTO)
230 static void ins_tabline __ARGS((int c)); 230 static void ins_tabline __ARGS((int c));
231 #endif 231 #endif
232 static void ins_left __ARGS((void)); 232 static void ins_left __ARGS((void));
1110 case K_X2RELEASE: 1110 case K_X2RELEASE:
1111 ins_mouse(c); 1111 ins_mouse(c);
1112 break; 1112 break;
1113 1113
1114 case K_MOUSEDOWN: /* Default action for scroll wheel up: scroll up */ 1114 case K_MOUSEDOWN: /* Default action for scroll wheel up: scroll up */
1115 ins_mousescroll(FALSE); 1115 ins_mousescroll(MSCR_DOWN);
1116 break; 1116 break;
1117 1117
1118 case K_MOUSEUP: /* Default action for scroll wheel down: scroll down */ 1118 case K_MOUSEUP: /* Default action for scroll wheel down: scroll down */
1119 ins_mousescroll(TRUE); 1119 ins_mousescroll(MSCR_UP);
1120 break;
1121
1122 case K_MOUSELEFT: /* Scroll wheel left */
1123 ins_mousescroll(MSCR_LEFT);
1124 break;
1125
1126 case K_MOUSERIGHT: /* Scroll wheel right */
1127 ins_mousescroll(MSCR_RIGHT);
1120 break; 1128 break;
1121 #endif 1129 #endif
1122 #ifdef FEAT_GUI_TABLINE 1130 #ifdef FEAT_GUI_TABLINE
1123 case K_TABLINE: 1131 case K_TABLINE:
1124 case K_TABMENU: 1132 case K_TABMENU:
3514 */ 3522 */
3515 if (c != Ctrl_R && vim_is_ctrl_x_key(c)) 3523 if (c != Ctrl_R && vim_is_ctrl_x_key(c))
3516 edit_submode_extra = NULL; 3524 edit_submode_extra = NULL;
3517 3525
3518 /* Ignore end of Select mode mapping and mouse scroll buttons. */ 3526 /* Ignore end of Select mode mapping and mouse scroll buttons. */
3519 if (c == K_SELECT || c == K_MOUSEDOWN || c == K_MOUSEUP) 3527 if (c == K_SELECT || c == K_MOUSEDOWN || c == K_MOUSEUP
3528 || c == K_MOUSELEFT || c == K_MOUSERIGHT)
3520 return retval; 3529 return retval;
3521 3530
3522 /* Set "compl_get_longest" when finding the first matches. */ 3531 /* Set "compl_get_longest" when finding the first matches. */
3523 if (ctrl_x_mode == CTRL_X_NOT_DEFINED_YET 3532 if (ctrl_x_mode == CTRL_X_NOT_DEFINED_YET
3524 || (ctrl_x_mode == 0 && !compl_started)) 3533 || (ctrl_x_mode == 0 && !compl_started))
8857 redraw_statuslines(); 8866 redraw_statuslines();
8858 #endif 8867 #endif
8859 } 8868 }
8860 8869
8861 static void 8870 static void
8862 ins_mousescroll(up) 8871 ins_mousescroll(dir)
8863 int up; 8872 int dir;
8864 { 8873 {
8865 pos_T tpos; 8874 pos_T tpos;
8866 # if defined(FEAT_WINDOWS) 8875 # if defined(FEAT_WINDOWS)
8867 win_T *old_curwin = curwin; 8876 win_T *old_curwin = curwin;
8868 # endif 8877 # endif
8896 || curwin != old_curwin 8905 || curwin != old_curwin
8897 # endif 8906 # endif
8898 ) 8907 )
8899 # endif 8908 # endif
8900 { 8909 {
8901 if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) 8910 if (dir == MSCR_DOWN || dir == MSCR_UP)
8902 scroll_redraw(up, (long)(curwin->w_botline - curwin->w_topline)); 8911 {
8912 if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL))
8913 scroll_redraw(dir,
8914 (long)(curwin->w_botline - curwin->w_topline));
8915 else
8916 scroll_redraw(dir, 3L);
8917 }
8918 #ifdef FEAT_GUI
8903 else 8919 else
8904 scroll_redraw(up, 3L); 8920 {
8921 int val, step = 6;
8922
8923 if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL))
8924 step = W_WIDTH(curwin);
8925 val = curwin->w_leftcol + (dir == MSCR_RIGHT ? -step : step);
8926 if (val < 0)
8927 val = 0;
8928 gui_do_horiz_scroll(val, TRUE);
8929 }
8930 #endif
8905 # ifdef FEAT_INS_EXPAND 8931 # ifdef FEAT_INS_EXPAND
8906 did_scroll = TRUE; 8932 did_scroll = TRUE;
8907 # endif 8933 # endif
8908 } 8934 }
8909 8935
8983 { 9009 {
8984 pos_T tpos; 9010 pos_T tpos;
8985 9011
8986 undisplay_dollar(); 9012 undisplay_dollar();
8987 tpos = curwin->w_cursor; 9013 tpos = curwin->w_cursor;
8988 if (gui_do_horiz_scroll()) 9014 if (gui_do_horiz_scroll(scrollbar_value, FALSE))
8989 { 9015 {
8990 start_arrow(&tpos); 9016 start_arrow(&tpos);
8991 # ifdef FEAT_CINDENT 9017 # ifdef FEAT_CINDENT
8992 can_cindent = TRUE; 9018 can_cindent = TRUE;
8993 # endif 9019 # endif