To: vim-dev@vim.org Subject: Patch 7.2b.010 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 7.2b.010 Problem: ":mksession" doesn't work for ":map , foo", ":sunmap ,". (Ethan Mallove) Solution: Check for "nxo", "nso" and other strange mapping combinations. Files: src/getchar.c *** ../vim-7.2b.009/src/getchar.c Tue Jun 24 22:18:17 2008 --- src/getchar.c Tue Jul 22 18:57:48 2008 *************** *** 4539,4545 **** buf_T *buf; /* buffer for local mappings or NULL */ { mapblock_T *mp; ! char_u c1, c2; char_u *p; char *cmd; int abbr; --- 4539,4545 ---- buf_T *buf; /* buffer for local mappings or NULL */ { mapblock_T *mp; ! char_u c1, c2, c3; char_u *p; char *cmd; int abbr; *************** *** 4592,4599 **** --- 4592,4603 ---- if (*p != NUL) continue; + /* It's possible to create a mapping and then ":unmap" certain + * modes. We recreate this here by mapping the individual + * modes, which requires up to three of them. */ c1 = NUL; c2 = NUL; + c3 = NUL; if (abbr) cmd = "abbr"; else *************** *** 4605,4613 **** case NORMAL: c1 = 'n'; break; - case VISUAL + SELECTMODE: - c1 = 'v'; - break; case VISUAL: c1 = 'x'; break; --- 4609,4614 ---- *************** *** 4617,4632 **** case OP_PENDING: c1 = 'o'; break; ! case NORMAL + VISUAL + SELECTMODE: c1 = 'n'; ! c2 = 'v'; break; ! case VISUAL + SELECTMODE + OP_PENDING: c1 = 'v'; c2 = 'o'; break; ! case NORMAL + OP_PENDING: c1 = 'n'; c2 = 'o'; break; case CMDLINE + INSERT: --- 4618,4662 ---- case OP_PENDING: c1 = 'o'; break; ! case NORMAL + VISUAL: c1 = 'n'; ! c2 = 'x'; break; ! case NORMAL + SELECTMODE: ! c1 = 'n'; ! c2 = 's'; ! break; ! case NORMAL + OP_PENDING: ! c1 = 'n'; ! c2 = 'o'; ! break; ! case VISUAL + SELECTMODE: c1 = 'v'; + break; + case VISUAL + OP_PENDING: + c1 = 'x'; c2 = 'o'; break; ! case SELECTMODE + OP_PENDING: ! c1 = 's'; ! c2 = 'o'; ! break; ! case NORMAL + VISUAL + SELECTMODE: ! c1 = 'n'; ! c2 = 'v'; ! break; ! case NORMAL + VISUAL + OP_PENDING: ! c1 = 'n'; ! c2 = 'x'; ! c3 = 'o'; ! break; ! case NORMAL + SELECTMODE + OP_PENDING: c1 = 'n'; + c2 = 's'; + c3 = 'o'; + break; + case VISUAL + SELECTMODE + OP_PENDING: + c1 = 'v'; c2 = 'o'; break; case CMDLINE + INSERT: *************** *** 4646,4652 **** EMSG(_("E228: makemap: Illegal mode")); return FAIL; } ! do /* may do this twice if c2 is set */ { /* When outputting <> form, need to make sure that 'cpo' * is set to the Vim default. */ --- 4676,4682 ---- EMSG(_("E228: makemap: Illegal mode")); return FAIL; } ! do /* do this twice if c2 is set, 3 times with c3 */ { /* When outputting <> form, need to make sure that 'cpo' * is set to the Vim default. */ *************** *** 4693,4701 **** || put_eol(fd) < 0) return FAIL; c1 = c2; ! c2 = NUL; ! } ! while (c1); } } --- 4723,4731 ---- || put_eol(fd) < 0) return FAIL; c1 = c2; ! c2 = c3; ! c3 = NUL; ! } while (c1 != NUL); } } *** ../vim-7.2b.009/src/version.c Fri Jul 18 17:11:39 2008 --- src/version.c Tue Jul 22 18:54:37 2008 *************** *** 678,679 **** --- 678,681 ---- { /* Add new patch number below this line */ + /**/ + 10, /**/ -- ARTHUR: Who are you? TALL KNIGHT: We are the Knights Who Say "Ni"! BEDEVERE: No! Not the Knights Who Say "Ni"! "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ download, build and distribute -- http://www.A-A-P.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///