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.0.141 < prev    next >
Encoding:
Internet Message Format  |  2002-01-16  |  4.6 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.0.141
  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.0.141
  11. Problem:    When using ":enew" in an empty buffer, some buffer-local things
  12.         are not cleared.  b:keymap_name is not set.
  13. Solution:   Clear user commands and mappings local to the buffer when re-using
  14.         the current buffer.  Reload the keymap.
  15. Files:        src/buffer.c
  16.  
  17.  
  18. *** ../vim60.140/src/buffer.c    Thu Jan 17 11:00:13 2002
  19. --- src/buffer.c    Thu Jan 17 10:55:32 2002
  20. ***************
  21. *** 46,52 ****
  22.   static int    ti_change __ARGS((char_u *str, char_u **last));
  23.   #endif
  24.   static void    free_buffer __ARGS((buf_T *));
  25. ! static void    free_buffer_stuff __ARGS((buf_T *));
  26.   static void    clear_wininfo __ARGS((buf_T *buf));
  27.   
  28.   #ifdef UNIX
  29. --- 46,52 ----
  30.   static int    ti_change __ARGS((char_u *str, char_u **last));
  31.   #endif
  32.   static void    free_buffer __ARGS((buf_T *));
  33. ! static void    free_buffer_stuff __ARGS((buf_T *buf, int free_options));
  34.   static void    clear_wininfo __ARGS((buf_T *buf));
  35.   
  36.   #ifdef UNIX
  37. ***************
  38. *** 393,399 ****
  39.       {
  40.           /* Free all internal variables and reset option values, to make
  41.            * ":bdel" compatible with Vim 5.7. */
  42. !         free_buffer_stuff(buf);
  43.   
  44.           /* Make it look like a new buffer. */
  45.           buf->b_flags = BF_CHECK_RO | BF_NEVERLOADED;
  46. --- 393,399 ----
  47.       {
  48.           /* Free all internal variables and reset option values, to make
  49.            * ":bdel" compatible with Vim 5.7. */
  50. !         free_buffer_stuff(buf, TRUE);
  51.   
  52.           /* Make it look like a new buffer. */
  53.           buf->b_flags = BF_CHECK_RO | BF_NEVERLOADED;
  54. ***************
  55. *** 481,487 ****
  56.   free_buffer(buf)
  57.       buf_T    *buf;
  58.   {
  59. !     free_buffer_stuff(buf);
  60.   #ifdef FEAT_PERL
  61.       perl_buf_free(buf);
  62.   #endif
  63. --- 481,487 ----
  64.   free_buffer(buf)
  65.       buf_T    *buf;
  66.   {
  67. !     free_buffer_stuff(buf, TRUE);
  68.   #ifdef FEAT_PERL
  69.       perl_buf_free(buf);
  70.   #endif
  71. ***************
  72. *** 498,518 ****
  73.    * Free stuff in the buffer for ":bdel" and when wiping out the buffer.
  74.    */
  75.       static void
  76. ! free_buffer_stuff(buf)
  77.       buf_T    *buf;
  78.   {
  79. !     clear_wininfo(buf);
  80.   #ifdef FEAT_EVAL
  81. !     var_clear(&buf->b_vars);        /* free all internal variables */
  82.   #endif
  83.   #ifdef FEAT_USR_CMDS
  84. !     uc_clear(&buf->b_ucmds);        /* clear local user commands */
  85.   #ifdef FEAT_LOCALMAP
  86.       map_clear_int(buf, MAP_ALL_MODES, TRUE, FALSE);  /* clear local mappings */
  87.       map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE);   /* clear local abbrevs */
  88.   #endif
  89. - #endif
  90. -     free_buf_options(buf, TRUE);
  91.   #ifdef FEAT_MBYTE
  92.       vim_free(buf->b_start_fenc);
  93.       buf->b_start_fenc = NULL;
  94. --- 498,522 ----
  95.    * Free stuff in the buffer for ":bdel" and when wiping out the buffer.
  96.    */
  97.       static void
  98. ! free_buffer_stuff(buf, free_options)
  99.       buf_T    *buf;
  100. +     int        free_options;        /* free options as well */
  101.   {
  102. !     if (free_options)
  103. !     {
  104. !     clear_wininfo(buf);        /* including window-local options */
  105. !     free_buf_options(buf, TRUE);
  106. !     }
  107.   #ifdef FEAT_EVAL
  108. !     var_clear(&buf->b_vars);        /* free all internal variables */
  109.   #endif
  110.   #ifdef FEAT_USR_CMDS
  111. !     uc_clear(&buf->b_ucmds);        /* clear local user commands */
  112. ! #endif
  113.   #ifdef FEAT_LOCALMAP
  114.       map_clear_int(buf, MAP_ALL_MODES, TRUE, FALSE);  /* clear local mappings */
  115.       map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE);   /* clear local abbrevs */
  116.   #endif
  117.   #ifdef FEAT_MBYTE
  118.       vim_free(buf->b_start_fenc);
  119.       buf->b_start_fenc = NULL;
  120. ***************
  121. *** 1290,1297 ****
  122.       if (buf != curbuf)     /* autocommands deleted the buffer! */
  123.           return NULL;
  124.       /* buf->b_nwindows = 0; why was this here? */
  125. ! #ifdef FEAT_EVAL
  126. !     var_clear(&buf->b_vars);    /* delete internal variables */
  127.   #endif
  128.       }
  129.       else
  130. --- 1294,1303 ----
  131.       if (buf != curbuf)     /* autocommands deleted the buffer! */
  132.           return NULL;
  133.       /* buf->b_nwindows = 0; why was this here? */
  134. !     free_buffer_stuff(buf, FALSE);    /* delete local variables et al. */
  135. ! #ifdef FEAT_KEYMAP
  136. !     /* need to reload lmaps and set b:keymap_name */
  137. !     curbuf->b_kmap_state |= KEYMAP_INIT;
  138.   #endif
  139.       }
  140.       else
  141. *** ../vim60.140/src/version.c    Thu Jan 17 11:00:13 2002
  142. --- src/version.c    Thu Jan 17 10:59:19 2002
  143. ***************
  144. *** 608,609 ****
  145. --- 608,611 ----
  146.   {   /* Add new patch number below this line */
  147. + /**/
  148. +     141,
  149.   /**/
  150.  
  151. -- 
  152. hundred-and-one symptoms of being an internet addict:
  153. 21. Your dog has its own home page.
  154.  
  155.  ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
  156. (((   Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim   )))
  157.  \\\  Help me helping AIDS orphans in Uganda - http://iccf-holland.org  ///
  158.