diff options
author | Bram Moolenaar <Bram@vim.org> | 2004-12-09 21:34:53 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2004-12-09 21:34:53 +0000 |
commit | 293ee4d421cd55f4a3c014c1c26edf02f718cc83 (patch) | |
tree | ae4856e718b752ea0c6c807912bfbb51967fae80 /src | |
parent | 741b07e0092eb6d7b81c9cbe149196c6cf9d5bbe (diff) |
updated for version 7.0021v7.0021
Diffstat (limited to 'src')
41 files changed, 546 insertions, 257 deletions
diff --git a/src/Make_ro.mak b/src/Make_ro.mak index 6ac2f94b50..82708f41fe 100644 --- a/src/Make_ro.mak +++ b/src/Make_ro.mak @@ -2,18 +2,16 @@ # Makefile for Vim on RISC OS - Andy Wingate # -GCC = gcc -mthrowback -CFLAGS = -DRISCOS -DFEAT_GUI -# Optimising on ex_docmd.c seems to cause segfaults on compilation. Needs investigation. -CCEX_DOCMD = $(GCC) $(CFLAGS) -CC = $(GCC) $(CFLAGS) -O2 +GCC = gcc -mthrowback +CFLAGS = -DRISCOS -DFEAT_GUI +CC = $(GCC) $(CFLAGS) -O2 # -DUP_BC_PC_EXTERN for term.c needed as BC defined in termlib.c and term.c TERMFLAG = -DUP_BC_PC_EXTERN ASMFLAGS = -throwback -objasm -gcc -OBJS = o.buffer o.charset o.digraph o.edit o.eval o.ex_cmds o.ex_cmds2 o.diff \ +OBJS = o.buffer o.charset o.diff o.digraph o.edit o.eval o.ex_cmds o.ex_cmds2 \ o.ex_docmd o.ex_eval o.ex_getln o.fileio o.fold o.getchar o.main o.mark o.mbyte \ o.memfile o.memline o.menu o.message o.misc1 o.misc2 o.move \ o.normal o.ops o.option o.quickfix o.regexp o.screen o.search \ @@ -26,7 +24,7 @@ Vim: $(OBJS) install: Vim squeeze -v Vim @.!Vim.Vim -clean: +clean: create o.!fake! 0 wipe o.* ~cf remove Vim @@ -35,134 +33,93 @@ o.swis: s.swis as $(ASMFLAGS) -o o.swis s.swis # Rules for object files -# You shouldn't need to put all this information in as all but term.c have the same -# rule (and only then to save extra defines) but some versions of make are awkward. + +o.%: c.% + $(CC) -c $< -o $@ o.buffer: c.buffer - $(CC) -c c.buffer -o o.buffer o.charset: c.charset - $(CC) -c c.charset -o o.charset o.digraph: c.digraph - $(CC) -c c.digraph -o o.digraph o.diff: c.diff - $(CC) -c c.diff -o o.diff o.edit: c.edit - $(CC) -c c.edit -o o.edit o.eval: c.eval - $(CC) -c c.eval -o o.eval o.ex_cmds: c.ex_cmds - $(CC) -c c.ex_cmds -o o.ex_cmds o.ex_cmds2: c.ex_cmds2 - $(CC) -c c.ex_cmds2 -o o.ex_cmds2 o.ex_docmd: c.ex_docmd - $(CCEX_DOCMD) -c c.ex_docmd -o o.ex_docmd o.ex_eval: c.ex_eval - $(CCEX_DOCMD) -c c.ex_eval -o o.ex_eval o.ex_getln: c.ex_getln - $(CC) -c c.ex_getln -o o.ex_getln o.fileio: c.fileio - $(CC) -c c.fileio -o o.fileio o.fold: c.fold - $(CC) -c c.fold -o o.fold o.getchar: c.getchar - $(CC) -c c.getchar -o o.getchar o.gui: c.gui - $(CC) -c c.gui -o o.gui o.gui_riscos: c.gui_riscos - $(CC) -c c.gui_riscos -o o.gui_riscos o.main: c.main - $(CC) -c c.main -o o.main o.mark: c.mark - $(CC) -c c.mark -o o.mark o.mbyte: c.mbyte - $(CC) -c c.mbyte -o o.mbyte o.memfile: c.memfile - $(CC) -c c.memfile -o o.memfile o.memline: c.memline - $(CC) -c c.memline -o o.memline o.menu: c.menu - $(CC) -c c.menu -o o.menu o.message: c.message - $(CC) -c c.message -o o.message o.misc1: c.misc1 - $(CC) -c c.misc1 -o o.misc1 o.misc2: c.misc2 - $(CC) -c c.misc2 -o o.misc2 o.move: c.move - $(CC) -c c.move -o o.move o.normal: c.normal - $(CC) -c c.normal -o o.normal o.ops: c.ops - $(CC) -c c.ops -o o.ops o.option: c.option - $(CC) -c c.option -o o.option o.os_riscos: c.os_riscos - $(CC) -c c.os_riscos -o o.os_riscos o.pty: c.pty - $(CC) -c c.pty -o p.pty o.quickfix: c.quickfix - $(CC) -c c.quickfix -o o.quickfix o.regexp: c.regexp - $(CC) -c c.regexp -o o.regexp o.screen: c.screen - $(CC) -c c.screen -o o.screen o.search: c.search - $(CC) -c c.search -o o.search o.syntax: c.syntax - $(CC) -c c.syntax -o o.syntax o.tag: c.tag - $(CC) -c c.tag -o o.tag o.term: c.term $(CC) $(TERMFLAG) -c c.term -o o.term o.termlib: c.termlib - $(CC) -c c.termlib -o o.termlib o.ui: c.ui - $(CC) -c c.ui -o o.ui o.undo: c.undo - $(CC) -c c.undo -o o.undo o.version: c.version - $(CC) -c c.version -o o.version o.window: c.window - $(CC) -c c.window -o o.window diff --git a/src/buffer.c b/src/buffer.c index a1d593dab3..f02c00d255 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -538,8 +538,7 @@ buf_freeall(buf, del_buf, wipe_buf) return; } # ifdef FEAT_EVAL - /* autocmds may abort script processing */ - if (aborting()) + if (aborting()) /* autocmds may abort script processing */ return; # endif @@ -755,7 +754,6 @@ handle_swap_exists(old_curbuf) # endif } swap_exists_action = SEA_NONE; - } #endif @@ -1031,8 +1029,12 @@ do_buffer(action, start, dir, count, forceit) * now. */ return FAIL; # endif + /* If it's still changed fail silently, the dialog already + * mentioned why it fails. */ + if (bufIsChanged(buf)) + return FAIL; } - if (bufIsChanged(buf)) + else #endif { EMSGN(_("E89: No write since last change for buffer %ld (add ! to override)"), @@ -1518,8 +1520,7 @@ buflist_new(ffname, sfname, lnum, flags) if (buf == curbuf) apply_autocmds(EVENT_BUFWIPEOUT, NULL, NULL, FALSE, curbuf); # ifdef FEAT_EVAL - /* autocmds may abort script processing */ - if (aborting()) + if (aborting()) /* autocmds may abort script processing */ return NULL; # endif #endif @@ -1572,8 +1573,7 @@ buflist_new(ffname, sfname, lnum, flags) if (buf != curbuf) /* autocommands deleted the buffer! */ return NULL; #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) - /* autocmds may abort script processing */ - if (aborting()) + if (aborting()) /* autocmds may abort script processing */ return NULL; #endif /* buf->b_nwindows = 0; why was this here? */ @@ -1649,8 +1649,7 @@ buflist_new(ffname, sfname, lnum, flags) if (flags & BLN_LISTED) apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, buf); # ifdef FEAT_EVAL - /* autocmds may abort script processing */ - if (aborting()) + if (aborting()) /* autocmds may abort script processing */ return NULL; # endif } diff --git a/src/eval.c b/src/eval.c index 88b954971d..27783792f0 100644 --- a/src/eval.c +++ b/src/eval.c @@ -4485,7 +4485,16 @@ f_foldtext(argvars, retvar) s = skipwhite(ml_get(lnum)); /* skip C comment-start */ if (s[0] == '/' && (s[1] == '*' || s[1] == '/')) + { s = skipwhite(s + 2); + if (*skipwhite(s) == NUL + && lnum + 1 < (linenr_T)vimvars[VV_FOLDEND].val) + { + s = skipwhite(ml_get(lnum + 1)); + if (*s == '*') + s = skipwhite(s + 1); + } + } txt = _("+-%s%3ld lines: "); r = alloc((unsigned)(STRLEN(txt) + STRLEN(vimvars[VV_FOLDDASHES].val) /* for %s */ diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 30a5f3a8a6..7ad5513bcd 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -7892,7 +7892,6 @@ update_topline_cursor() ex_normal(eap) exarg_T *eap; { - oparg_T oa; int save_msg_scroll = msg_scroll; int save_restart_edit = restart_edit; int save_msg_didout = msg_didout; @@ -7996,30 +7995,17 @@ ex_normal(eap) */ do { - clear_oparg(&oa); - finish_op = FALSE; if (eap->addr_count != 0) { curwin->w_cursor.lnum = eap->line1++; curwin->w_cursor.col = 0; } - /* - * Stuff the argument into the typeahead buffer. - * Execute normal_cmd() until there is no typeahead left. - */ - ins_typebuf( + exec_normal_cmd( #ifdef FEAT_MBYTE arg != NULL ? arg : #endif - eap->arg, eap->forceit ? REMAP_NONE : REMAP_YES, 0, - TRUE, FALSE); - while ((!stuff_empty() || (!typebuf_typed() && typebuf.tb_len > 0)) - && !got_int) - { - update_topline_cursor(); - normal_cmd(&oa, FALSE); /* execute a Normal mode cmd */ - } + eap->arg, eap->forceit ? REMAP_NONE : REMAP_YES, FALSE); } while (eap->addr_count > 0 && eap->line1 <= eap->line2 && !got_int); } @@ -8085,6 +8071,35 @@ ex_stopinsert(eap) } #endif +#if defined(FEAT_EX_EXTRA) || defined(FEAT_MENU) || defined(PROTO) +/* + * Execute normal mode command "cmd". + * "remap" can be REMAP_NONE or REMAP_YES. + */ + void +exec_normal_cmd(cmd, remap, silent) + char_u *cmd; + int remap; + int silent; +{ + oparg_T oa; + + /* + * Stuff the argument into the typeahead buffer. + * Execute normal_cmd() until there is no typeahead left. + */ + clear_oparg(&oa); + finish_op = FALSE; + ins_typebuf(cmd, remap, 0, TRUE, silent); + while ((!stuff_empty() || (!typebuf_typed() && typebuf.tb_len > 0)) + && !got_int) + { + update_topline_cursor(); + normal_cmd(&oa, FALSE); /* execute a Normal mode cmd */ + } +} +#endif + #ifdef FEAT_FIND_ID static void ex_checkpath(eap) @@ -8742,6 +8757,17 @@ makeopens(fd, dirnow) } /* + * If there is an empty, unnamed buffer we will wipe it out later. + * Remember the buffer number. + */ + if (put_line(fd, "if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == ''") == FAIL) + return FAIL; + if (put_line(fd, " let s:wipebuf = bufnr('%')") == FAIL) + return FAIL; + if (put_line(fd, "endif") == FAIL) + return FAIL; + + /* * Now save the current files, current buffer first. */ if (put_line(fd, "set shortmess=aoO") == FAIL) @@ -8876,6 +8902,18 @@ makeopens(fd, dirnow) return FAIL; /* + * Wipe out an empty unnamed buffer we started in. + */ + if (put_line(fd, "if exists('s:wipebuf')") == FAIL) + return FAIL; + if (put_line(fd, " exe 'bwipe ' . s:wipebuf") == FAIL) + return FAIL; + if (put_line(fd, "endif") == FAIL) + return FAIL; + if (put_line(fd, "unlet! s:wipebuf") == FAIL) + return FAIL; + + /* * Restore window sizes again after jumping around in windows, because the * current window has a minimum size while others may not. */ diff --git a/src/ex_eval.c b/src/ex_eval.c index 8be11e13b0..e2699bc74c 100644 --- a/src/ex_eval.c +++ b/src/ex_eval.c @@ -1820,19 +1820,25 @@ ex_endtry(eap) } /* - * Function to be called before a failed command invokes a sequence of - * autocommands for cleanup. (Failure means here that a call to emsg() has - * been made, an interrupt occurred, or there is an uncaught exception from a - * previous autocommand execution of the same command.) This function works a - * bit like ex_finally() except that there was not actually an extra try block - * around the part that failed and an error or interrupt has not (yet) been - * converted to an exception. This function saves the - * error/interrupt/exception state and prepares for the call to do_cmdline() - * that is going to be made for the cleanup autocommand execution. + * enter_cleanup() and leave_cleanup() * - * Stores the pending error/interrupt/exception state in the cleanup_T - * structure pointed to by "csp", which has to be passed as an argument to - * leave_cleanup() after the autocommand execution has finished. + * Functions to be called before/after invoking a sequence of autocommands for + * cleanup for a failed command. (Failure means here that a call to emsg() + * has been made, an interrupt occurred, or there is an uncaught exception + * from a previous autocommand execution of the same command.) + * + * Call enter_cleanup() with a pointer to a cleanup_T and pass the same + * pointer to leave_cleanup(). The cleanup_T structure stores the pending + * error/interrupt/exception state. + */ + +/* + * This function works a bit like ex_finally() except that there was not + * actually an extra try block around the part that failed and an error or + * interrupt has not (yet) been converted to an exception. This function + * saves the error/interrupt/ exception state and prepares for the call to + * do_cmdline() that is going to be made for the cleanup autocommand + * execution. */ void enter_cleanup(csp) @@ -1883,16 +1889,19 @@ enter_cleanup(csp) } /* - * Function to be called after a failed command invoked a sequence of - * autocommands for cleanup. It is a bit like ex_endtry() except that there - * was not actually an extra try block around the part that failed and an - * error or interrupt had not (yet) been converted to an exception when the - * cleanup autocommand sequence was invoked. This function has to be called - * with the address of the cleanup_T structure filled by enter_cleanup() as an - * argument; it restores the error/interrupt/exception state saved by that - * function - except there was an aborting error, an interrupt or an uncaught - * exception during execution of the cleanup autocommands. In the latter - * case, the saved error/interrupt/ exception state is discarded. + * See comment above enter_cleanup() for how this function is used. + * + * This function is a bit like ex_endtry() except that there was not actually + * an extra try block around the part that failed and an error or interrupt + * had not (yet) been converted to an exception when the cleanup autocommand + * sequence was invoked. + * + * This function has to be called with the address of the cleanup_T structure + * filled by enter_cleanup() as an argument; it restores the error/interrupt/ + * exception state saved by that function - except there was an aborting + * error, an interrupt or an uncaught exception during execution of the + * cleanup autocommands. In the latter case, the saved error/interrupt/ + * exception state is discarded. */ void leave_cleanup(csp) @@ -1959,7 +1968,7 @@ leave_cleanup(csp) /* Report if required by the 'verbose' option or when debugging. */ report_resume_pending(pending, - (pending & CSTP_THROW) ? (void *)current_exception : NULL); + (pending & CSTP_THROW) ? (void *)current_exception : NULL); } } diff --git a/src/fileio.c b/src/fileio.c index 029a339380..c37c96a1d9 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -3985,8 +3985,9 @@ restore_backup: * journalled. Syncing the file slows down the system, but assures it has * been written to disk and we don't lose it. * For a device do try the fsync() but don't complain if it does not work - * (could be a pipe). */ - if (fsync(fd) != 0 && !device) + * (could be a pipe). + * If the 'fsync' option is FALSE, don't fsync(). Useful for laptops. */ + if (p_fs && fsync(fd) != 0 && !device) { errmsg = (char_u *)_("E667: Fsync failed"); end = 0; diff --git a/src/fold.c b/src/fold.c index 1aee87ce28..bb268fb255 100644 --- a/src/fold.c +++ b/src/fold.c @@ -902,6 +902,8 @@ foldMoveTo(updown, dir, count) int level; int last; + checkupdate(curwin); + /* Repeat "count" times. */ for (n = 0; n < count; ++n) { @@ -2883,7 +2885,7 @@ foldRemove(gap, top, bot) { /* Found an entry below top. */ fold_changed = TRUE; - if (fp->fd_top + fp->fd_len > bot) + if (fp->fd_top + fp->fd_len - 1 > bot) { /* 5: Make fold that includes bot start below bot. */ foldMarkAdjustRecurse(&fp->fd_nested, diff --git a/src/getchar.c b/src/getchar.c index f050540919..dd52ac4e9a 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -1514,6 +1514,17 @@ vgetc() continue; } #endif +#ifdef HAVE_GTK2 + /* GTK: <F10> normally selects the menu, but it's passed until + * here to allow mapping it. Intercept and invoke the GTK + * behavior if it's not mapped. */ + if (c == K_F10 && gui.menubar != NULL) + { + gtk_menu_shell_select_first(GTK_MENU_SHELL(gui.menubar), FALSE); + continue; + } +#endif + #ifdef FEAT_GUI /* Translate K_CSI to CSI. The special key is only used to avoid * it being recognized as the start of a special key. */ @@ -1540,7 +1551,14 @@ vgetc() case K_KDIVIDE: c = '/'; break; case K_KMULTIPLY: c = '*'; break; case K_KENTER: c = CAR; break; - case K_KPOINT: c = '.'; break; + case K_KPOINT: +#ifdef WIN32 + /* Can be either '.' or a ',', * + * depending on the type of keypad. */ + c = MapVirtualKey(VK_DECIMAL, 2); break; +#else + c = '.'; break; +#endif case K_K0: c = '0'; break; case K_K1: c = '1'; break; case K_K2: c = '2'; break; diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c index 6d6d55d095..b67b6f2d21 100644 --- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -3080,6 +3080,17 @@ gui_mch_init(void) gui.menubar = gtk_menu_bar_new(); gtk_widget_set_name(gui.menubar, "vim-menubar"); +# ifdef HAVE_GTK2 + /* Avoid that GTK takes <F10> away from us. */ + { + GtkSettings *gtk_settings; + + gtk_settings = gtk_settings_get_for_screen(gdk_screen_get_default()); + g_object_set(gtk_settings, "gtk-menu-bar-accel", NULL, NULL); + } +# endif + + # ifdef FEAT_GUI_GNOME if (using_gnome) { diff --git a/src/gui_mac.c b/src/gui_mac.c index f60567e570..7ad96fc298 100644 --- a/src/gui_mac.c +++ b/src/gui_mac.c @@ -3792,6 +3792,27 @@ gui_mch_draw_string(row, col, s, len, flags) (void)SwapQDTextFlags(qd_flags); } + /* + * When antialiasing we're using srcOr mode, we have to clear the block + * before drawing the text. + * Also needed when 'linespace' is non-zero to remove the cursor and + * underlining. + * But not when drawing transparently. + * The following is like calling gui_mch_clear_block(row, col, row, col + + * len - 1), but without setting the bg color to gui.back_pixel. + */ + if (((sys_version >= 0x1020 && p_antialias) || p_linespace != 0) + && !(flags & DRAW_TRANSP)) + { + Rect rc; + + rc.left = FILL_X(col); + rc.top = FILL_Y(row); + rc.right = FILL_X(col + len) + (col + len == Columns); + rc.bottom = FILL_Y(row + 1); + EraseRect(&rc); + } + if (sys_version >= 0x1020 && p_antialias) { StyleParameter face; @@ -3806,22 +3827,6 @@ gui_mch_draw_string(row, col, s, len, flags) /* Quartz antialiasing works only in srcOr transfer mode. */ TextMode(srcOr); - if (!(flags & DRAW_TRANSP)) - { - /* - * Since we're using srcOr mode, we have to clear the block - * before drawing the text. The following is like calling - * gui_mch_clear_block(row, col, row, col + len - 1), - * but without setting the bg color to gui.back_pixel. - */ - Rect rc; - rc.left = FILL_X(col); - rc.top = FILL_Y(row); - rc.right = FILL_X(col + len) + (col + len == Columns); - rc.bottom = FILL_Y(row + 1); - EraseRect(&rc); - } - MoveTo(TEXT_X(col), TEXT_Y(row)); DrawText((char*)s, 0, len); } diff --git a/src/gui_w32.c b/src/gui_w32.c index 0afa12de26..461dcefc5d 100644 --- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -789,8 +789,7 @@ _WndProc( break; } #ifdef MSWIN_FIND_REPLACE - else - if (uMsg == s_findrep_msg && s_findrep_msg != 0) + else if (uMsg == s_findrep_msg && s_findrep_msg != 0) { _OnFindRepl(); } @@ -1411,20 +1410,6 @@ gui_mch_set_bg_color(guicolor_T color) #include <imm.h> /* - * display composition string(korean) - */ - static void -DisplayCompStringOpaque(char_u *s, int len) -{ - int OldBkMode = GetBkMode(s_hdc); - - SetBkMode(s_hdc, OPAQUE); - gui_outstr_nowrap(s, len, GUI_MON_TRS_CURSOR, - (guicolor_T)0, (guicolor_T)0, 0); - SetBkMode(s_hdc, OldBkMode); -} - -/* * handle WM_IME_NOTIFY message */ static LRESULT diff --git a/src/gui_w48.c b/src/gui_w48.c index 4f0bab7007..516d070eb3 100644 --- a/src/gui_w48.c +++ b/src/gui_w48.c @@ -488,27 +488,49 @@ char_to_string(int ch, char_u *string, int slen) WCHAR wstring[2]; char_u *ws = NULL;; - /* "ch" is a UTF-16 character. Convert it to a string of bytes. When - * "enc_codepage" is non-zero use the standard Win32 function, otherwise - * use our own conversion function (e.g., for UTF-8). */ - wstring[0] = ch; - if (enc_codepage > 0) - len = WideCharToMultiByte(enc_codepage, 0, wstring, 1, string, slen, - 0, NULL); + if (os_version.dwPlatformId != VER_PLATFORM_WIN32_NT) + { + /* On Windows 95/98 we apparently get the character in the active + * codepage, not in UCS-2. If conversion is needed convert it to + * UCS-2 first. */ + if ((int)GetACP() == enc_codepage) + len = 0; /* no conversion required */ + else + { + string[0] = ch; + len = MultiByteToWideChar(GetACP(), 0, string, 1, wstring, 2); + } + } else { + wstring[0] = ch; len = 1; - ws = ucs2_to_enc(wstring, &len); - if (ws == NULL) - len = 0; + } + + if (len > 0) + { + /* "ch" is a UTF-16 character. Convert it to a string of bytes. When + * "enc_codepage" is non-zero use the standard Win32 function, + * otherwise use our own conversion function (e.g., for UTF-8). */ + if (enc_codepage > 0) + len = WideCharToMultiByte(enc_codepage, 0, wstring, len, + string, slen, 0, NULL); else { - if (len > slen) /* just in case */ - len = slen; - mch_memmove(string, ws, len); - vim_free(ws); + len = 1; + ws = ucs2_to_enc(wstring, &len); + if (ws == NULL) + len = 0; + else + { + if (len > slen) /* just in case */ + len = slen; + mch_memmove(string, ws, len); + vim_free(ws); + } } } + if (len == 0) #endif { @@ -682,9 +704,10 @@ _OnMouseButtonDown( * Holding down the left and right buttons simulates pushing the middle * button. */ - if (repeated_click && - ((button == MOUSE_LEFT && s_button_pending == MOUSE_RIGHT) || - (button == MOUSE_RIGHT && s_button_pending == MOUSE_LEFT))) + if (repeated_click + && ((button == MOUSE_LEFT && s_button_pending == MOUSE_RIGHT) + || (button == MOUSE_RIGHT + && s_button_pending == MOUSE_LEFT))) { /* * Hmm, gui.c will ignore more than one button down at a time, so @@ -745,7 +768,7 @@ _OnMouseMoveOrRelease( { /* Delayed action for mouse down event */ _OnMouseEvent(s_button_pending, s_x_pending, - s_y_pending, FALSE, s_kFlags_pending); + s_y_pending, FALSE, s_kFlags_pending); s_button_pending = -1; } if (s_uMsg == WM_MOUSEMOVE) @@ -1532,6 +1555,9 @@ process_message(void) int i; int modifiers = 0; int key; +#ifdef FEAT_MENU + static char_u k10[] = {K_SPECIAL, 'k', ';', 0}; +#endif GetMessage(&msg, NULL, 0, 0); @@ -1619,11 +1645,11 @@ process_message(void) && (vk != VK_SPACE || !(GetKeyState(VK_MENU) & 0x8000))) { #ifdef FEAT_MENU - /* Check for <F10>: Windows selects the menu. Ignore it when - * 'winaltkeys' is "yes" or "menu" */ + /* Check for <F10>: Windows selects the menu. When <F10> is + * mapped we want to use the mapping instead. */ if (vk == VK_F10 && gui.menu_is_active - && (*p_wak == 'y' || *p_wak == 'm')) + && check_map(k10, State, FALSE) == NULL) break; #endif if (GetKeyState(VK_SHIFT) & 0x8000) @@ -1734,9 +1760,10 @@ process_message(void) #endif #ifdef FEAT_MENU - /* Check for <F10>: Windows selects the menu. Don't let Windows handle it - * when 'winaltkeys' is "no" */ - if (vk != VK_F10 || *p_wak != 'n') + /* Check for <F10>: Default effect is to select the menu. When <F10> is + * mapped we need to stop it here to avoid strange effects (e.g., for the + * key-up event) */ + if (vk != VK_F10 || check_map(k10, State, FALSE) == NULL) #endif DispatchMessage(&msg); } @@ -1829,6 +1856,11 @@ gui_mch_wait_for_chars(int wtime) s_wait_timer = 0; } allow_scrollbar = FALSE; + + /* Clear pending mouse button, the release event may have been + * taken by the dialog window. */ + s_button_pending = -1; + return OK; } } diff --git a/src/if_cscope.c b/src/if_cscope.c index 012e86c76f..f218ea4214 100644 --- a/src/if_cscope.c +++ b/src/if_cscope.c @@ -1092,7 +1092,7 @@ cs_find_common(opt, pat, forceit, verbose) < |