comparison src/getchar.c @ 1678:b60a569eb708 v7.2b.010

updated for version 7.2b-010
author vimboss
date Tue, 22 Jul 2008 16:58:47 +0000
parents 46bbe11644e0
children f10fe14748e2
comparison
equal deleted inserted replaced
1677:b98975453785 1678:b60a569eb708
4537 makemap(fd, buf) 4537 makemap(fd, buf)
4538 FILE *fd; 4538 FILE *fd;
4539 buf_T *buf; /* buffer for local mappings or NULL */ 4539 buf_T *buf; /* buffer for local mappings or NULL */
4540 { 4540 {
4541 mapblock_T *mp; 4541 mapblock_T *mp;
4542 char_u c1, c2; 4542 char_u c1, c2, c3;
4543 char_u *p; 4543 char_u *p;
4544 char *cmd; 4544 char *cmd;
4545 int abbr; 4545 int abbr;
4546 int hash; 4546 int hash;
4547 int did_cpo = FALSE; 4547 int did_cpo = FALSE;
4590 && p[2] == (int)KE_SNR) 4590 && p[2] == (int)KE_SNR)
4591 break; 4591 break;
4592 if (*p != NUL) 4592 if (*p != NUL)
4593 continue; 4593 continue;
4594 4594
4595 /* It's possible to create a mapping and then ":unmap" certain
4596 * modes. We recreate this here by mapping the individual
4597 * modes, which requires up to three of them. */
4595 c1 = NUL; 4598 c1 = NUL;
4596 c2 = NUL; 4599 c2 = NUL;
4600 c3 = NUL;
4597 if (abbr) 4601 if (abbr)
4598 cmd = "abbr"; 4602 cmd = "abbr";
4599 else 4603 else
4600 cmd = "map"; 4604 cmd = "map";
4601 switch (mp->m_mode) 4605 switch (mp->m_mode)
4603 case NORMAL + VISUAL + SELECTMODE + OP_PENDING: 4607 case NORMAL + VISUAL + SELECTMODE + OP_PENDING:
4604 break; 4608 break;
4605 case NORMAL: 4609 case NORMAL:
4606 c1 = 'n'; 4610 c1 = 'n';
4607 break; 4611 break;
4608 case VISUAL + SELECTMODE:
4609 c1 = 'v';
4610 break;
4611 case VISUAL: 4612 case VISUAL:
4612 c1 = 'x'; 4613 c1 = 'x';
4613 break; 4614 break;
4614 case SELECTMODE: 4615 case SELECTMODE:
4615 c1 = 's'; 4616 c1 = 's';
4616 break; 4617 break;
4617 case OP_PENDING: 4618 case OP_PENDING:
4618 c1 = 'o'; 4619 c1 = 'o';
4619 break; 4620 break;
4621 case NORMAL + VISUAL:
4622 c1 = 'n';
4623 c2 = 'x';
4624 break;
4625 case NORMAL + SELECTMODE:
4626 c1 = 'n';
4627 c2 = 's';
4628 break;
4629 case NORMAL + OP_PENDING:
4630 c1 = 'n';
4631 c2 = 'o';
4632 break;
4633 case VISUAL + SELECTMODE:
4634 c1 = 'v';
4635 break;
4636 case VISUAL + OP_PENDING:
4637 c1 = 'x';
4638 c2 = 'o';
4639 break;
4640 case SELECTMODE + OP_PENDING:
4641 c1 = 's';
4642 c2 = 'o';
4643 break;
4620 case NORMAL + VISUAL + SELECTMODE: 4644 case NORMAL + VISUAL + SELECTMODE:
4621 c1 = 'n'; 4645 c1 = 'n';
4622 c2 = 'v'; 4646 c2 = 'v';
4623 break; 4647 break;
4648 case NORMAL + VISUAL + OP_PENDING:
4649 c1 = 'n';
4650 c2 = 'x';
4651 c3 = 'o';
4652 break;
4653 case NORMAL + SELECTMODE + OP_PENDING:
4654 c1 = 'n';
4655 c2 = 's';
4656 c3 = 'o';
4657 break;
4624 case VISUAL + SELECTMODE + OP_PENDING: 4658 case VISUAL + SELECTMODE + OP_PENDING:
4625 c1 = 'v'; 4659 c1 = 'v';
4626 c2 = 'o';
4627 break;
4628 case NORMAL + OP_PENDING:
4629 c1 = 'n';
4630 c2 = 'o'; 4660 c2 = 'o';
4631 break; 4661 break;
4632 case CMDLINE + INSERT: 4662 case CMDLINE + INSERT:
4633 if (!abbr) 4663 if (!abbr)
4634 cmd = "map!"; 4664 cmd = "map!";
4644 break; 4674 break;
4645 default: 4675 default:
4646 EMSG(_("E228: makemap: Illegal mode")); 4676 EMSG(_("E228: makemap: Illegal mode"));
4647 return FAIL; 4677 return FAIL;
4648 } 4678 }
4649 do /* may do this twice if c2 is set */ 4679 do /* do this twice if c2 is set, 3 times with c3 */
4650 { 4680 {
4651 /* When outputting <> form, need to make sure that 'cpo' 4681 /* When outputting <> form, need to make sure that 'cpo'
4652 * is set to the Vim default. */ 4682 * is set to the Vim default. */
4653 if (!did_cpo) 4683 if (!did_cpo)
4654 { 4684 {
4691 || putc(' ', fd) < 0 4721 || putc(' ', fd) < 0
4692 || put_escstr(fd, mp->m_str, 1) == FAIL 4722 || put_escstr(fd, mp->m_str, 1) == FAIL
4693 || put_eol(fd) < 0) 4723 || put_eol(fd) < 0)
4694 return FAIL; 4724 return FAIL;
4695 c1 = c2; 4725 c1 = c2;
4696 c2 = NUL; 4726 c2 = c3;
4697 } 4727 c3 = NUL;
4698 while (c1); 4728 } while (c1 != NUL);
4699 } 4729 }
4700 } 4730 }
4701 4731
4702 if (did_cpo) 4732 if (did_cpo)
4703 if (fprintf(fd, "let &cpo=s:cpo_save") < 0 4733 if (fprintf(fd, "let &cpo=s:cpo_save") < 0