diff options
-rw-r--r-- | Filelist | 2 | ||||
-rw-r--r-- | src/Make_cyg_ming.mak | 3 | ||||
-rw-r--r-- | src/Make_morph.mak | 1 | ||||
-rw-r--r-- | src/Make_mvc.mak | 8 | ||||
-rw-r--r-- | src/Make_vms.mms | 9 | ||||
-rw-r--r-- | src/Makefile | 16 | ||||
-rw-r--r-- | src/README.md | 3 | ||||
-rwxr-xr-x | src/auto/configure | 2 | ||||
-rw-r--r-- | src/configure.ac | 2 | ||||
-rw-r--r-- | src/edit.c | 147 | ||||
-rw-r--r-- | src/ex_cmds.c | 6 | ||||
-rw-r--r-- | src/ex_docmd.c | 2 | ||||
-rw-r--r-- | src/ex_getln.c | 8 | ||||
-rw-r--r-- | src/insexpand.c | 2 | ||||
-rw-r--r-- | src/libvterm/src/termmouse.c (renamed from src/libvterm/src/mouse.c) | 0 | ||||
-rw-r--r-- | src/main.c | 6 | ||||
-rw-r--r-- | src/message.c | 12 | ||||
-rw-r--r-- | src/misc1.c | 50 | ||||
-rw-r--r-- | src/misc2.c | 98 | ||||
-rw-r--r-- | src/mouse.c | 2314 | ||||
-rw-r--r-- | src/normal.c | 1133 | ||||
-rw-r--r-- | src/proto.h | 1 | ||||
-rw-r--r-- | src/proto/edit.pro | 4 | ||||
-rw-r--r-- | src/proto/misc1.pro | 1 | ||||
-rw-r--r-- | src/proto/misc2.pro | 2 | ||||
-rw-r--r-- | src/proto/mouse.pro | 19 | ||||
-rw-r--r-- | src/proto/normal.pro | 5 | ||||
-rw-r--r-- | src/proto/term.pro | 6 | ||||
-rw-r--r-- | src/proto/ui.pro | 5 | ||||
-rw-r--r-- | src/search.c | 2 | ||||
-rw-r--r-- | src/term.c | 233 | ||||
-rw-r--r-- | src/ui.c | 791 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/vim.h | 6 | ||||
-rw-r--r-- | src/window.c | 4 |
35 files changed, 2415 insertions, 2490 deletions
@@ -80,6 +80,7 @@ SRC_ALL = \ src/message_test.c \ src/misc1.c \ src/misc2.c \ + src/mouse.c \ src/move.c \ src/mysign \ src/nbdebug.c \ @@ -231,6 +232,7 @@ SRC_ALL = \ src/proto/message.pro \ src/proto/misc1.pro \ src/proto/misc2.pro \ + src/proto/mouse.pro \ src/proto/move.pro \ src/proto/netbeans.pro \ src/proto/normal.pro \ diff --git a/src/Make_cyg_ming.mak b/src/Make_cyg_ming.mak index 281d147cac..bc60eb9a9c 100644 --- a/src/Make_cyg_ming.mak +++ b/src/Make_cyg_ming.mak @@ -754,6 +754,7 @@ OBJ = \ $(OUTDIR)/message.o \ $(OUTDIR)/misc1.o \ $(OUTDIR)/misc2.o \ + $(OUTDIR)/mouse.o \ $(OUTDIR)/move.o \ $(OUTDIR)/mbyte.o \ $(OUTDIR)/normal.o \ @@ -866,7 +867,7 @@ ifeq ($(TERMINAL),yes) OBJ += $(OUTDIR)/terminal.o \ $(OUTDIR)/encoding.o \ $(OUTDIR)/keyboard.o \ - $(OUTDIR)/mouse.o \ + $(OUTDIR)/termmouse.o \ $(OUTDIR)/parser.o \ $(OUTDIR)/pen.o \ $(OUTDIR)/termscreen.o \ diff --git a/src/Make_morph.mak b/src/Make_morph.mak index a69eda0edd..6b549df215 100644 --- a/src/Make_morph.mak +++ b/src/Make_morph.mak @@ -74,6 +74,7 @@ SRC = arabic.c \ message.c \ misc1.c \ misc2.c \ + mouse.c \ move.c \ normal.c \ ops.c \ diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak index 8861994adb..10c827a51b 100644 --- a/src/Make_mvc.mak +++ b/src/Make_mvc.mak @@ -365,7 +365,7 @@ TERM_OBJ = \ $(OBJDIR)/terminal.obj \ $(OBJDIR)/encoding.obj \ $(OBJDIR)/keyboard.obj \ - $(OBJDIR)/mouse.obj \ + $(OBJDIR)/termmouse.obj \ $(OBJDIR)/parser.obj \ $(OBJDIR)/pen.obj \ $(OBJDIR)/termscreen.obj \ @@ -762,6 +762,7 @@ OBJ = \ $(OUTDIR)\message.obj \ $(OUTDIR)\misc1.obj \ $(OUTDIR)\misc2.obj \ + $(OUTDIR)\mouse.obj \ $(OUTDIR)\move.obj \ $(OUTDIR)\normal.obj \ $(OUTDIR)\ops.obj \ @@ -1601,6 +1602,8 @@ $(OUTDIR)/misc1.obj: $(OUTDIR) misc1.c $(INCL) $(OUTDIR)/misc2.obj: $(OUTDIR) misc2.c $(INCL) +$(OUTDIR)/mouse.obj: $(OUTDIR) mouse.c $(INCL) + $(OUTDIR)/move.obj: $(OUTDIR) move.c $(INCL) $(OUTDIR)/mbyte.obj: $(OUTDIR) mbyte.c $(INCL) @@ -1736,7 +1739,7 @@ $(OUTDIR)/encoding.obj: $(OUTDIR) libvterm/src/encoding.c $(TERM_DEPS) $(OUTDIR)/keyboard.obj: $(OUTDIR) libvterm/src/keyboard.c $(TERM_DEPS) -$(OUTDIR)/mouse.obj: $(OUTDIR) libvterm/src/mouse.c $(TERM_DEPS) +$(OUTDIR)/termmouse.obj: $(OUTDIR) libvterm/src/termmouse.c $(TERM_DEPS) $(OUTDIR)/parser.obj: $(OUTDIR) libvterm/src/parser.c $(TERM_DEPS) @@ -1822,6 +1825,7 @@ proto.h: \ proto/message.pro \ proto/misc1.pro \ proto/misc2.pro \ + proto/mouse.pro \ proto/move.pro \ proto/mbyte.pro \ proto/normal.pro \ diff --git a/src/Make_vms.mms b/src/Make_vms.mms index c86ec35e87..6c791f13e7 100644 --- a/src/Make_vms.mms +++ b/src/Make_vms.mms @@ -316,7 +316,8 @@ SRC = arabic.c arglist.c autocmd.c beval.c blob.c blowfish.c buffer.c \ if_cscope.c if_xcmdsrv.c fileio.c filepath.c, findfile.c fold.c \ getchar.c hardcopy.c hashtab.c highlight.c \ indent.c insexpand.c json.c list.c main.c map.c mark.c menu.c mbyte.c \ - memfile.c memline.c message.c misc1.c misc2.c move.c normal.c ops.c \ + memfile.c memline.c message.c misc1.c misc2.c mouse.c move.c normal.c \ + ops.c \ option.c optionstr.c popupmnu.c popupwin.c profiler.c quickfix.c \ regexp.c scriptfile.c \ search.c session.c sha256.c sign.c spell.c spellfile.c syntax.c tag.c \ @@ -336,7 +337,8 @@ OBJ = arabic.obj arglist.obj autocmd.obj beval.obj blob.obj blowfish.obj \ findfile.obj fold.obj getchar.obj hardcopy.obj hashtab.obj \ highlight.obj indent.obj insexpand.obj json.obj list.obj main.obj \ map.obj mark.obj menu.obj memfile.obj memline.obj message.obj \ - misc1.obj misc2.obj move.obj mbyte.obj normal.obj ops.obj option.obj \ + misc1.obj misc2.obj mouse.obj move.obj mbyte.obj normal.obj ops.obj \ + option.obj \ optionstr.obj popupmnu.obj popupwin.obj profiler.obj quickfix.obj \ regexp.obj scriptfile.obj \ search.obj session.obj sha256.obj sign.obj spell.obj spellfile.obj \ @@ -697,6 +699,9 @@ misc1.obj : misc1.c vim.h [.auto]config.h feature.h os_unix.h \ misc2.obj : misc2.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h beval.h \ [.proto]gui_beval.pro option.h ex_cmds.h proto.h globals.h +mouse.obj : mouse.c vim.h [.auto]config.h feature.h os_unix.h \ + ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h beval.h \ + [.proto]gui_beval.pro option.h ex_cmds.h proto.h globals.h move.obj : move.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h beval.h \ [.proto]gui_beval.pro option.h ex_cmds.h proto.h globals.h diff --git a/src/Makefile b/src/Makefile index 0bfc92d940..eebef252e4 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1629,6 +1629,7 @@ BASIC_SRC = \ message.c \ misc1.c \ misc2.c \ + mouse.c \ move.c \ mbyte.c \ normal.c \ @@ -1762,6 +1763,7 @@ OBJ_COMMON = \ objects/menu.o \ objects/misc1.o \ objects/misc2.o \ + objects/mouse.o \ objects/move.o \ objects/mbyte.o \ objects/normal.o \ @@ -1921,6 +1923,7 @@ PRO_AUTO = \ message.pro \ misc1.pro \ misc2.pro \ + mouse.pro \ move.pro \ normal.pro \ ops.pro \ @@ -3287,6 +3290,9 @@ objects/misc1.o: misc1.c objects/misc2.o: misc2.c $(CCC) -o $@ misc2.c +objects/mouse.o: mouse.c + $(CCC) -o $@ mouse.c + objects/move.o: move.c $(CCC) -o $@ move.c @@ -3430,8 +3436,8 @@ objects/encoding.o: libvterm/src/encoding.c $(TERM_DEPS) objects/keyboard.o: libvterm/src/keyboard.c $(TERM_DEPS) $(CCCTERM) -o $@ libvterm/src/keyboard.c -objects/mouse.o: libvterm/src/mouse.c $(TERM_DEPS) - $(CCCTERM) -o $@ libvterm/src/mouse.c +objects/termmouse.o: libvterm/src/termmouse.c $(TERM_DEPS) + $(CCCTERM) -o $@ libvterm/src/termmouse.c objects/parser.o: libvterm/src/parser.c $(TERM_DEPS) $(CCCTERM) -o $@ libvterm/src/parser.c @@ -3769,6 +3775,10 @@ objects/misc2.o: misc2.c vim.h protodef.h auto/config.h feature.h os_unix.h \ auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ proto.h globals.h +objects/mouse.o: mouse.c vim.h protodef.h auto/config.h feature.h os_unix.h \ + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h objects/move.o: move.c vim.h protodef.h auto/config.h feature.h os_unix.h \ auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ @@ -4063,7 +4073,7 @@ objects/encoding.o: libvterm/src/encoding.c libvterm/src/vterm_internal.h \ objects/keyboard.o: libvterm/src/keyboard.c libvterm/src/vterm_internal.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h \ libvterm/src/utf8.h -objects/mouse.o: libvterm/src/mouse.c libvterm/src/vterm_internal.h \ +objects/termmouse.o: libvterm/src/termmouse.c libvterm/src/vterm_internal.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h \ libvterm/src/utf8.h objects/parser.o: libvterm/src/parser.c libvterm/src/vterm_internal.h \ diff --git a/src/README.md b/src/README.md index d1a27d5e41..dcbf408b5d 100644 --- a/src/README.md +++ b/src/README.md @@ -54,6 +54,7 @@ memfile.c | storing lines for buffers in a swapfile memline.c | storing lines for buffers in memory menu.c | menus message.c | (error) messages +mouse.c | handling the mouse ops.c | handling operators ("d", "y", "p") option.c | options optionstr.c | handling string options @@ -63,7 +64,7 @@ profiler.c | vim script profiler quickfix.c | quickfix commands (":make", ":cn") regexp.c | pattern matching scriptfile.c | runtime directory handling and sourcing scripts -screen.c | updating the windows +screen.c | lower level screen functions search.c | pattern searching session.c | sessions and views sign.c | signs diff --git a/src/auto/configure b/src/auto/configure index 8dcad0bb8e..c9b370cc7f 100755 --- a/src/auto/configure +++ b/src/auto/configure @@ -7909,7 +7909,7 @@ if test "$enable_terminal" = "yes" -a "$enable_channel" = "yes"; then TERM_SRC="libvterm/src/encoding.c libvterm/src/keyboard.c libvterm/src/mouse.c libvterm/src/parser.c libvterm/src/pen.c libvterm/src/termscreen.c libvterm/src/state.c libvterm/src/unicode.c libvterm/src/vterm.c" - TERM_OBJ="objects/encoding.o objects/keyboard.o objects/mouse.o objects/parser.o objects/pen.o objects/termscreen.o objects/state.o objects/unicode.o objects/vterm.o" + TERM_OBJ="objects/encoding.o objects/keyboard.o objects/termmouse.o objects/parser.o objects/pen.o objects/termscreen.o objects/state.o objects/unicode.o objects/vterm.o" fi diff --git a/src/configure.ac b/src/configure.ac index f7a71d079d..97753a6552 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -2106,7 +2106,7 @@ if test "$enable_terminal" = "yes" -a "$enable_channel" = "yes"; then AC_DEFINE(FEAT_TERMINAL) TERM_SRC="libvterm/src/encoding.c libvterm/src/keyboard.c libvterm/src/mouse.c libvterm/src/parser.c libvterm/src/pen.c libvterm/src/termscreen.c libvterm/src/state.c libvterm/src/unicode.c libvterm/src/vterm.c" AC_SUBST(TERM_SRC) - TERM_OBJ="objects/encoding.o objects/keyboard.o objects/mouse.o objects/parser.o objects/pen.o objects/termscreen.o objects/state.o objects/unicode.o objects/vterm.o" + TERM_OBJ="objects/encoding.o objects/keyboard.o objects/termmouse.o objects/parser.o objects/pen.o objects/termscreen.o objects/state.o objects/unicode.o objects/vterm.o" AC_SUBST(TERM_OBJ) fi diff --git a/src/edit.c b/src/edit.c index 67141448fa..c6486be3a7 100644 --- a/src/edit.c +++ b/src/edit.c @@ -27,7 +27,6 @@ static void ins_ctrl_v(void); #ifdef FEAT_JOB_CHANNEL static void init_prompt(int cmdchar_todo); #endif -static void undisplay_dollar(void); static void insert_special(int, int, int); static void internal_format(int textwidth, int second_indent, int flags, int format_only, int c); static void check_auto_format(int); @@ -56,10 +55,6 @@ static void ins_ctrl_o(void); static void ins_shift(int c, int lastc); static void ins_del(void); static int ins_bs(int c, int mode, int *inserted_space_p); -#ifdef FEAT_MOUSE -static void ins_mouse(int c); -static void ins_mousescroll(int dir); -#endif #if defined(FEAT_GUI_TABLINE) || defined(PROTO) static void ins_tabline(int c); #endif @@ -322,9 +317,7 @@ edit( im_set_active(curbuf->b_p_iminsert == B_IMODE_IM); #endif -#ifdef FEAT_MOUSE setmouse(); -#endif #ifdef FEAT_CMDL_INFO clear_showcmd(); #endif @@ -1759,7 +1752,7 @@ display_dollar(colnr_T col) * Call this function before moving the cursor from the normal insert position * in insert mode. */ - static void + void undisplay_dollar(void) { if (dollar_vcol >= 0) @@ -4508,9 +4501,7 @@ ins_esc( /* need to position cursor again (e.g. when on a TAB ) */ changed_cline_bef_curs(); -#ifdef FEAT_MOUSE setmouse(); -#endif #ifdef CURSOR_SHAPE ui_cursor_shape(); /* may show different cursor shape */ #endif @@ -5157,134 +5148,6 @@ ins_bs( return did_backspace; } -#ifdef FEAT_MOUSE - static void -ins_mouse(int c) -{ - pos_T tpos; - win_T *old_curwin = curwin; - -# ifdef FEAT_GUI - /* When GUI is active, also move/paste when 'mouse' is empty */ - if (!gui.in_use) -# endif - if (!mouse_has(MOUSE_INSERT)) - return; - - undisplay_dollar(); - tpos = curwin->w_cursor; - if (do_mouse(NULL, c, BACKWARD, 1L, 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; -#ifdef FEAT_JOB_CHANNEL - if (bt_prompt(curbuf)) - // Restart Insert mode when re-entering the prompt buffer. - curbuf->b_prompt_insert = 'A'; -#endif - } - start_arrow(curwin == old_curwin ? &tpos : NULL); - if (curwin != new_curwin && win_valid(new_curwin)) - { - curwin = new_curwin; - curbuf = curwin->w_buffer; - } -# ifdef FEAT_CINDENT - can_cindent = TRUE; -# endif - } - - /* redraw status lines (in case another window became active) */ - redraw_statuslines(); -} - - static void -ins_mousescroll(int dir) -{ - pos_T tpos; - win_T *old_curwin = curwin, *wp; - int did_scroll = FALSE; - - tpos = curwin->w_cursor; - - if (mouse_row >= 0 && mouse_col >= 0) - { - int row, col; - - row = mouse_row; - col = mouse_col; - - /* find the window at the pointer coordinates */ - wp = mouse_find_win(&row, &col, FIND_POPUP); - 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, - (long)(curwin->w_botline - curwin->w_topline)); - else - scroll_redraw(dir, 3L); -# ifdef FEAT_TEXT_PROP - if (WIN_IS_POPUP(curwin)) - popup_set_firstline(curwin); -# endif - } -#ifdef FEAT_GUI - else - { - int val, step = 6; - - if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) - step = curwin->w_width; - val = curwin->w_leftcol + (dir == MSCR_RIGHT ? -step : step); - if (val < 0) - val = 0; - gui_do_horiz_scroll(val, TRUE); - } -#endif - did_scroll = TRUE; - } - - curwin->w_redr_status = TRUE; - - curwin = old_curwin; - curbuf = curwin->w_buffer; - - /* The popup menu may overlay the window, need to redraw it. - * TODO: Would be more efficient to only redraw the windows that are - * overlapped by the popup menu. */ - if (pum_visible() && did_scroll) - { - redraw_all_later(NOT_VALID); - ins_compl_show_pum(); - } - - if (!EQUAL_POS(curwin->w_cursor, tpos)) - { - start_arrow(&tpos); -# ifdef FEAT_CINDENT - can_cindent = TRUE; -# endif - } -} -#endif - /* * Handle receiving P_PS: start paste mode. Inserts the following text up to * P_PE literally. @@ -6401,10 +6264,16 @@ do_insert_char_pre(int c) #if defined(FEAT_CINDENT) || defined(PROTO) int -can_cindent_get(void) +get_can_cindent(void) { return can_cindent; } + + void +set_can_cindent(int val) +{ + can_cindent = val; +} #endif /* diff --git a/src/ex_cmds.c b/src/ex_cmds.c index dceb1a7395..6ae5969a07 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -4221,9 +4221,7 @@ do_sub(exarg_T *eap) * properly */ save_State = State; State = CONFIRM; -#ifdef FEAT_MOUSE - setmouse(); /* disable mouse in xterm */ -#endif + setmouse(); // disable mouse in xterm curwin->w_cursor.col = regmatch.startpos[0].col; if (curwin->w_p_crb) do_check_cursorbind(); @@ -4397,9 +4395,7 @@ do_sub(exarg_T *eap) scrolldown_clamp(); } State = save_State; -#ifdef FEAT_MOUSE setmouse(); -#endif if (vim_strchr(p_cpo, CPO_UNDO) != NULL) --no_u_sync; diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 0e0e1b8794..d67bfac7b3 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -7578,9 +7578,7 @@ ex_normal(exarg_T *eap) restore_current_state(&save_state); --ex_normal_busy; -#ifdef FEAT_MOUSE setmouse(); -#endif #ifdef CURSOR_SHAPE ui_cursor_shape(); /* may show different cursor shape */ #endif diff --git a/src/ex_getln.c b/src/ex_getln.c index 4c88bc86b9..ef9967e9b3 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -924,9 +924,7 @@ getcmdline_int( im_set_active(TRUE); #endif -#ifdef FEAT_MOUSE setmouse(); -#endif #ifdef CURSOR_SHAPE ui_cursor_shape(); /* may show different cursor shape */ #endif @@ -2389,9 +2387,7 @@ returncmd: im_save_status(b_im_ptr); im_set_active(FALSE); #endif -#ifdef FEAT_MOUSE setmouse(); -#endif #ifdef CURSOR_SHAPE ui_cursor_shape(); /* may show different cursor shape */ #endif @@ -4160,9 +4156,7 @@ open_cmdwin(void) exmode_active = 0; State = NORMAL; -# ifdef FEAT_MOUSE setmouse(); -# endif // Trigger CmdwinEnter autocommands. trigger_cmd_autocmd(cmdwin_type, EVENT_CMDWINENTER); @@ -4290,9 +4284,7 @@ open_cmdwin(void) # endif State = save_State; -# ifdef FEAT_MOUSE setmouse(); -# endif return cmdwin_result; } diff --git a/src/insexpand.c b/src/insexpand.c index f472bca4bb..eecc7f684f 100644 --- a/src/insexpand.c +++ b/src/insexpand.c @@ -1995,7 +1995,7 @@ ins_compl_prep(int c) } #ifdef FEAT_CINDENT - want_cindent = (can_cindent_get() && cindent_on()); + want_cindent = (get_can_cindent() && cindent_on()); #endif // When completing whole lines: fix indent for 'cindent'. // Otherwise, break line if it's too long. diff --git a/src/libvterm/src/mouse.c b/src/libvterm/src/termmouse.c index ae74cfc4bb..ae74cfc4bb 100644 --- a/src/libvterm/src/mouse.c +++ b/src/libvterm/src/termmouse.c diff --git a/src/main.c b/src/main.c index 8c56c17b50..536378561f 100644 --- a/src/main.c +++ b/src/main.c @@ -684,9 +684,7 @@ vim_main2(void) starttermcap(); /* start termcap if not done by wait_return() */ TIME_MSG("start termcap"); -#ifdef FEAT_MOUSE - setmouse(); /* may start using the mouse */ -#endif + setmouse(); // may start using the mouse if (scroll_region) scroll_region_reset(); /* In case Rows changed */ scroll_start(); /* may scroll the screen to the right position */ @@ -1182,9 +1180,7 @@ main_loop( emsg_skip = 0; # endif emsg_off = 0; -# ifdef FEAT_MOUSE setmouse(); -# endif settmode(TMODE_RAW); starttermcap(); scroll_start(); diff --git a/src/message.c b/src/message.c index 7810c5be17..b40753415b 100644 --- a/src/message.c +++ b/src/message.c @@ -1058,9 +1058,7 @@ wait_return(int redraw) screenalloc(FALSE); State = HITRETURN; -#ifdef FEAT_MOUSE setmouse(); -#endif #ifdef USE_ON_FLY_SCROLL dont_scroll = TRUE; /* disallow scrolling here */ #endif @@ -1216,9 +1214,7 @@ wait_return(int redraw) */ tmpState = State; State = oldState; /* restore State before set_shellsize */ -#ifdef FEAT_MOUSE setmouse(); -#endif msg_check(); #if defined(UNIX) || defined(VMS) @@ -2684,9 +2680,7 @@ do_more_prompt(int typed_char) } State = ASKMORE; -#ifdef FEAT_MOUSE setmouse(); -#endif if (typed_char == NUL) msg_moremsg(FALSE); for (;;) @@ -2902,9 +2896,7 @@ do_more_prompt(int typed_char) /* clear the --more-- message */ screen_fill((int)Rows - 1, (int)Rows, 0, (int)Columns, ' ', ' ', 0); State = oldState; -#ifdef FEAT_MOUSE setmouse(); -#endif if (quit_more) { msg_row = Rows - 1; @@ -3608,9 +3600,7 @@ do_dialog( oldState = State; State = CONFIRM; -#ifdef FEAT_MOUSE setmouse(); -#endif /* * Since we wait for a keypress, don't make the @@ -3673,9 +3663,7 @@ do_dialog( } State = oldState; -#ifdef FEAT_MOUSE setmouse(); -#endif --no_wait_return; msg_end_prompt(); diff --git a/src/misc1.c b/src/misc1.c index e05ad1654e..3c0bd41280 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -1148,14 +1148,12 @@ ask_yesno(char_u *str, int direct) settmode(TMODE_RAW); ++no_wait_return; #ifdef USE_ON_FLY_SCROLL - dont_scroll = TRUE; /* disallow scrolling here */ -#endif - State = CONFIRM; /* mouse behaves like with :confirm */ -#ifdef FEAT_MOUSE - setmouse(); /* disables mouse for xterm */ + dont_scroll = TRUE; // disallow scrolling here #endif + State = CONFIRM; // mouse behaves like with :confirm + setmouse(); // disables mouse for xterm ++no_mapping; - ++allow_keys; /* no mapping here, but recognize keys */ + ++allow_keys; // no mapping here, but recognize keys while (r != 'y' && r != 'n') { @@ -1172,47 +1170,13 @@ ask_yesno(char_u *str, int direct) } --no_wait_return; State = save_State; -#ifdef FEAT_MOUSE setmouse(); -#endif --no_mapping; --allow_keys; return r; } -#if defined(FEAT_MOUSE) || defined(PROTO) -/* - * Return TRUE if "c" is a mouse key. - */ - int -is_mouse_key(int c) -{ - return c == K_LEFTMOUSE - || c == K_LEFTMOUSE_NM - || c == K_LEFTDRAG - || c == K_LEFTRELEASE - || c == K_LEFTRELEASE_NM - || c == K_MOUSEMOVE - || c == K_MIDDLEMOUSE - || c == K_MIDDLEDRAG - || c == K_MIDDLERELEASE - || c == K_RIGHTMOUSE - || c == K_RIGHTDRAG - || c == K_RIGHTRELEASE - || c == K_MOUSEDOWN - || c == K_MOUSEUP - || c == K_MOUSELEFT - || c == K_MOUSERIGHT - || c == K_X1MOUSE - || c == K_X1DRAG - || c == K_X1RELEASE - || c == K_X2MOUSE - || c == K_X2DRAG - || c == K_X2RELEASE; -} -#endif - #if defined(FEAT_EVAL) || defined(PROTO) /* @@ -1340,6 +1304,8 @@ f_state(typval_T *argvars, typval_T *rettv) if (channel_in_blocking_wait()) may_add_state_char(&ga, include, 'w'); # endif + if (!get_was_safe_state()) + may_add_state_char(&ga, include, 'S'); for (i = 0; i < get_callback_depth() && i < 3; ++i) may_add_state_char(&ga, include, 'c'); if (msg_scrolled > 0) @@ -1572,10 +1538,8 @@ prompt_for_number(int *mouse_used) cmdline_row = 0; save_State = State; State = CMDLINE; -#ifdef FEAT_MOUSE // May show different mouse shape. setmouse(); -#endif i = get_number(TRUE, mouse_used); if (KeyTyped) @@ -1590,10 +1554,8 @@ prompt_for_number(int *mouse_used) else cmdline_row = save_cmdline_row; State = save_State; -#ifdef FEAT_MOUSE // May need to restore mouse shape. setmouse(); -#endif return i; } diff --git a/src/misc2.c b/src/misc2.c index dab23e23ae..f4da4c2d5b 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -2491,44 +2491,6 @@ static struct key_name_entry #define KEY_NAMES_TABLE_LEN (sizeof(key_names_table) / sizeof(struct key_name_entry)) -#ifdef FEAT_MOUSE -static struct mousetable -{ - int pseudo_code; /* Code for pseudo mouse event */ - int button; /* Which mouse button is it? */ - int is_click; /* Is it a mouse button click event? */ - int is_drag; /* Is it a mouse drag event? */ -} mouse_table[] = -{ - {(int)KE_LEFTMOUSE, MOUSE_LEFT, TRUE, FALSE}, -#ifdef FEAT_GUI - {(int)KE_LEFTMOUSE_NM, MOUSE_LEFT, TRUE, FALSE}, -#endif - {(int)KE_LEFTDRAG, MOUSE_LEFT, FALSE, TRUE}, - {(int)KE_LEFTRELEASE, MOUSE_LEFT, FALSE, FALSE}, -#ifdef FEAT_GUI - {(int)KE_LEFTRELEASE_NM, MOUSE_LEFT, FALSE, FALSE}, -#endif - {(int)KE_MIDDLEMOUSE, MOUSE_MIDDLE, TRUE, FALSE}, - {(int)KE_MIDDLEDRAG, MOUSE_MIDDLE, FALSE, TRUE}, - {(int)KE_MIDDLERELEASE, MOUSE_MIDDLE, FALSE, FALSE}, - {(int)KE_RIGHTMOUSE, MOUSE_RIGHT, TRUE, FALSE}, - {(int)KE_RIGHTDRAG, MOUSE_RIGHT, FALSE, TRUE}, - {(int)KE_RIGHTRELEASE, MOUSE_RIGHT, FALSE, FALSE}, - {(int)KE_X1MOUSE, MOUSE_X1, TRUE, FALSE}, - {(int)KE_X1DRAG, MOUSE_X1, FALSE, TRUE}, - {(int)KE_X1RELEASE, MOUSE_X1, FALSE, FALSE}, - {(int)KE_X2MOUSE, MOUSE_X2, TRUE, FALSE}, - {(int)KE_X2DRAG, MOUSE_X2, FALSE, TRUE}, - {(int)KE_X2RELEASE, MOUSE_X2, FALSE, FALSE}, - /* DRAG without CLICK */ - {(int)KE_MOUSEMOVE, MOUSE_RELEASE, FALSE, TRUE}, - /* RELEASE without CLICK */ - {(int)KE_IGNORE, MOUSE_RELEASE, FALSE, FALSE}, - {0, 0, 0, 0}, -}; -#endif /* FEAT_MOUSE */ - /* * Return the modifier mask bit (MOD_MASK_*) which corresponds to the given * modifier name ('S' for Shift, 'C' for Ctrl etc). @@ -3050,66 +3012,6 @@ get_key_name(int i) return key_names_table[i].name; } -#if defined(FEAT_MOUSE) || defined(PROTO) -/* - * Look up the given mouse code to return the relevant information in the other - * arguments. Return which button is down or was released. - */ - int -get_mouse_button(int code, int *is_click, int *is_drag) -{ - int i; - - for (i = 0; mouse_table[i].pseudo_code; i++) - if (code == mouse_table[i].pseudo_code) - { - *is_click = mouse_table[i].is_click; - *is_drag = mouse_table[i].is_drag; - return mouse_table[i].button; - } - return 0; /* Shouldn't get here */ -} - -/* - * Return the appropriate pseudo mouse event token (KE_LEFTMOUSE etc) based on - * the given information about which mouse button is down, and whether the - * mouse was clicked, dragged or released. - */ - int -get_pseudo_mouse_code( - int button, /* eg MOUSE_LEFT */ - int is_click, - int is_drag) -{ - int i; - - for (i = 0; mouse_table[i].pseudo_code; i++) - if (button == mouse_table[i].button - && is_click == mouse_table[i].is_click - && is_drag == mouse_table[i].is_drag) - { -#ifdef FEAT_GUI - /* Trick: a non mappable left click and release has mouse_col -1 - * or added MOUSE_COLOFF. Used for 'mousefocus' in - * gui_mouse_moved() */ - if (mouse_col < 0 || mouse_col > MOUSE_COLOFF) - { - if (mouse_col < 0) - mouse_col = 0; - else - mouse_col -= MOUSE_COLOFF; - if (mouse_table[i].pseudo_code == (int)KE_LEFTMOUSE) - return (int)KE_LEFTMOUSE_NM; - if (mouse_table[i].pseudo_code == (int)KE_LEFTRELEASE) |