home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 6.2.228 < prev    next >
Encoding:
Internet Message Format  |  2004-02-02  |  4.3 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.2.228
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 6.2.228
  11. Problem:    Receiving CTRL-\ CTRL-N after typing "f" or "m" doesn't switch Vim
  12.         back to Normal mode.  Same for CTRL-\ CTRL-G.
  13. Solution:   Check if the character typed after a command is CTRL-\ and obtain
  14.         another character to check for CTRL-N or CTRL-G, waiting up to
  15.         'ttimeoutlen' msec.
  16. Files:        src/normal.c
  17.  
  18.  
  19. *** ../vim-6.2.227/src/normal.c    Tue Jan 27 17:09:16 2004
  20. --- src/normal.c    Tue Feb  3 16:26:11 2004
  21. ***************
  22. *** 250,256 ****
  23.       {Ctrl_Y,    nv_scroll_line,    0,            FALSE},
  24.       {Ctrl_Z,    nv_suspend,    0,            0},
  25.       {ESC,    nv_esc,        0,            FALSE},
  26. !     {Ctrl_BSL,    nv_normal,    0,            0},
  27.       {Ctrl_RSB,    nv_ident,    NV_NCW,            0},
  28.       {Ctrl_HAT,    nv_hat,        NV_NCW,            0},
  29.       {Ctrl__,    nv_error,    0,            0},
  30. --- 250,256 ----
  31.       {Ctrl_Y,    nv_scroll_line,    0,            FALSE},
  32.       {Ctrl_Z,    nv_suspend,    0,            0},
  33.       {ESC,    nv_esc,        0,            FALSE},
  34. !     {Ctrl_BSL,    nv_normal,    NV_NCH_ALW,        0},
  35.       {Ctrl_RSB,    nv_ident,    NV_NCW,            0},
  36.       {Ctrl_HAT,    nv_hat,        NV_NCW,            0},
  37.       {Ctrl__,    nv_error,    0,            0},
  38. ***************
  39. *** 880,886 ****
  40.   #ifdef FEAT_CMDL_INFO
  41.           need_flushbuf |= add_to_showcmd(ca.nchar);
  42.   #endif
  43. !         if (ca.nchar == 'r' || ca.nchar == '\'' || ca.nchar == '`')
  44.           {
  45.           cp = &ca.extra_char;    /* need to get a third character */
  46.           if (ca.nchar != 'r')
  47. --- 880,887 ----
  48.   #ifdef FEAT_CMDL_INFO
  49.           need_flushbuf |= add_to_showcmd(ca.nchar);
  50.   #endif
  51. !         if (ca.nchar == 'r' || ca.nchar == '\'' || ca.nchar == '`'
  52. !                               || ca.nchar == Ctrl_BSL)
  53.           {
  54.           cp = &ca.extra_char;    /* need to get a third character */
  55.           if (ca.nchar != 'r')
  56. ***************
  57. *** 992,997 ****
  58. --- 993,1035 ----
  59.   #endif
  60.           }
  61.   
  62. +         /*
  63. +          * When the next character is CTRL-\ a following CTRL-N means the
  64. +          * command is aborted and we go to Normal mode.
  65. +          */
  66. +         if (cp == &ca.extra_char
  67. +             && ca.nchar == Ctrl_BSL
  68. +             && (ca.extra_char == Ctrl_N || ca.extra_char == Ctrl_G))
  69. +         {
  70. +         ca.cmdchar = Ctrl_BSL;
  71. +         ca.nchar = ca.extra_char;
  72. +         idx = find_command(ca.cmdchar);
  73. +         }
  74. +         else if (*cp == Ctrl_BSL)
  75. +         {
  76. +         long towait = (p_ttm >= 0 ? p_ttm : p_tm);
  77. +         /* There is a busy wait here when typing "f<C-\>" and then
  78. +          * something different from CTRL-N.  Can't be avoided. */
  79. +         while ((c = vpeekc()) <= 0 && towait > 0L)
  80. +         {
  81. +             do_sleep(towait > 50L ? 50L : towait);
  82. +             towait -= 50L;
  83. +         }
  84. +         if (c > 0)
  85. +         {
  86. +             c = safe_vgetc();
  87. +             if (c != Ctrl_N && c != Ctrl_G)
  88. +             vungetc(c);
  89. +             else
  90. +             {
  91. +             ca.cmdchar = Ctrl_BSL;
  92. +             ca.nchar = c;
  93. +             idx = find_command(ca.cmdchar);
  94. +             }
  95. +         }
  96. +         }
  97.   #ifdef FEAT_MBYTE
  98.           /* When getting a text character and the next character is a
  99.            * multi-byte character, it could be a composing character.
  100. ***************
  101. *** 7746,7754 ****
  102.   nv_normal(cap)
  103.       cmdarg_T    *cap;
  104.   {
  105. !     int c = safe_vgetc();
  106. !     if (c == Ctrl_N || c == Ctrl_G)
  107.       {
  108.       clearop(cap->oap);
  109.       if (restart_edit != 0 && p_smd)
  110. --- 7784,7790 ----
  111.   nv_normal(cap)
  112.       cmdarg_T    *cap;
  113.   {
  114. !     if (cap->nchar == Ctrl_N || cap->nchar == Ctrl_G)
  115.       {
  116.       clearop(cap->oap);
  117.       if (restart_edit != 0 && p_smd)
  118. ***************
  119. *** 7766,7772 ****
  120.       }
  121.   #endif
  122.       /* CTRL-\ CTRL-G restarts Insert mode when 'insertmode' is set. */
  123. !     if (c == Ctrl_G && p_im)
  124.           restart_edit = 'a';
  125.       }
  126.       else
  127. --- 7802,7808 ----
  128.       }
  129.   #endif
  130.       /* CTRL-\ CTRL-G restarts Insert mode when 'insertmode' is set. */
  131. !     if (cap->nchar == Ctrl_G && p_im)
  132.           restart_edit = 'a';
  133.       }
  134.       else
  135. *** ../vim-6.2.227/src/version.c    Tue Feb  3 16:20:37 2004
  136. --- src/version.c    Tue Feb  3 16:28:19 2004
  137. ***************
  138. *** 639,640 ****
  139. --- 639,642 ----
  140.   {   /* Add new patch number below this line */
  141. + /**/
  142. +     228,
  143.   /**/
  144.  
  145. -- 
  146. Time is an illusion.  Lunchtime doubly so.
  147.         -- Ford Prefect, in Douglas Adams'
  148.            "The Hitchhiker's Guide to the Galaxy"
  149.  
  150.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  151. ///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  152. \\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
  153.  \\\  Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html  ///
  154.