To: vim-dev@vim.org Subject: Patch 6.1.219 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.219 Problem: When using ":amenu :b 1" with a Visual selection and 'insertmode' is set, Vim does not return to Insert mode. (Mickael Marchand) Solution: Add the command CTRL-\ CTRL-G that goes to Insert mode if 'insertmode' is set and to Normal mode otherwise. Append this to menus defined with ":amenu". Files: src/edit.c, src/ex_getln.c, src/normal.c *** ../vim61.218/src/edit.c Tue Sep 17 21:19:42 2002 --- src/edit.c Sun Oct 13 15:22:09 2002 *************** *** 592,598 **** ins_compl_prep(c); #endif ! /* CTRL-\ CTRL-N goes to Normal mode */ if (c == Ctrl_BSL) { /* may need to redraw when no more chars available now */ --- 598,605 ---- ins_compl_prep(c); #endif ! /* CTRL-\ CTRL-N goes to Normal mode, CTRL-\ CTRL-G goes to mode ! * selected with 'insertmode'. */ if (c == Ctrl_BSL) { /* may need to redraw when no more chars available now */ *************** *** 602,612 **** c = safe_vgetc(); --no_mapping; --allow_keys; ! if (c != Ctrl_N) /* it's something else */ { vungetc(c); c = Ctrl_BSL; } else { count = 0; --- 609,621 ---- c = safe_vgetc(); --no_mapping; --allow_keys; ! if (c != Ctrl_N && c != Ctrl_G) /* it's something else */ { vungetc(c); c = Ctrl_BSL; } + else if (c == Ctrl_G && p_im) + continue; else { count = 0; *** ../vim61.218/src/ex_getln.c Mon Sep 23 21:32:08 2002 --- src/ex_getln.c Sun Oct 13 15:35:07 2002 *************** *** 535,541 **** #endif /* FEAT_WILDMENU */ ! /* CTRL-\ CTRL-N goes to Normal mode */ if (c == Ctrl_BSL) { ++no_mapping; --- 535,542 ---- #endif /* FEAT_WILDMENU */ ! /* CTRL-\ CTRL-N goes to Normal mode, CTRL-\ CTRL-G goes to Insert ! * mode when 'insertmode' is set. */ if (c == Ctrl_BSL) { ++no_mapping; *************** *** 543,555 **** c = safe_vgetc(); --no_mapping; --allow_keys; ! if (c != Ctrl_N) { vungetc(c); c = Ctrl_BSL; } else { gotesc = TRUE; /* will free ccline.cmdbuff after putting it in history */ goto returncmd; /* back to Normal mode */ --- 544,558 ---- c = safe_vgetc(); --no_mapping; --allow_keys; ! if (c != Ctrl_N && c != Ctrl_G) { vungetc(c); c = Ctrl_BSL; } else { + if (c == Ctrl_G && p_im && restart_edit == 0) + restart_edit = 'a'; gotesc = TRUE; /* will free ccline.cmdbuff after putting it in history */ goto returncmd; /* back to Normal mode */ *** ../vim61.218/src/normal.c Mon Sep 16 22:00:32 2002 --- src/normal.c Sun Oct 13 15:14:34 2002 *************** *** 7570,7576 **** nv_normal(cap) cmdarg_T *cap; { ! if (safe_vgetc() == Ctrl_N) { clearop(cap->oap); if (restart_edit != 0 && p_smd) --- 7571,7579 ---- nv_normal(cap) cmdarg_T *cap; { ! int c = safe_vgetc(); ! ! if (c == Ctrl_N || c == Ctrl_G) { clearop(cap->oap); if (restart_edit != 0 && p_smd) *************** *** 7587,7592 **** --- 7590,7598 ---- redraw_curbuf_later(INVERTED); } #endif + /* CTRL-\ CTRL-G restarts Insert mode when 'insertmode' is set. */ + if (c == Ctrl_G && p_im) + restart_edit = 'a'; } else clearopbeep(cap->oap); *** ../vim61.218/src/version.c Sat Oct 12 21:16:50 2002 --- src/version.c Sun Oct 13 16:02:56 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 219, /**/ -- Your mouse has moved. Windows must be restarted for the change to take effect. Reboot now? /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ /// Creator of Vim - Vi IMproved -- http://www.vim.org \\\ \\\ Project leader for A-A-P -- http://www.a-a-p.org /// \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///