home *** CD-ROM | disk | FTP | other *** search
- To: vim-dev@vim.org
- Subject: Patch 6.0.141
- Fcc: outbox
- From: Bram Moolenaar <Bram@moolenaar.net>
- MIME-Version: 1.0
- Content-Type: text/plain; charset=ISO-8859-1
- Content-Transfer-Encoding: 8bit
- ------------
-
- Patch 6.0.141
- Problem: When using ":enew" in an empty buffer, some buffer-local things
- are not cleared. b:keymap_name is not set.
- Solution: Clear user commands and mappings local to the buffer when re-using
- the current buffer. Reload the keymap.
- Files: src/buffer.c
-
-
- *** ../vim60.140/src/buffer.c Thu Jan 17 11:00:13 2002
- --- src/buffer.c Thu Jan 17 10:55:32 2002
- ***************
- *** 46,52 ****
- static int ti_change __ARGS((char_u *str, char_u **last));
- #endif
- static void free_buffer __ARGS((buf_T *));
- ! static void free_buffer_stuff __ARGS((buf_T *));
- static void clear_wininfo __ARGS((buf_T *buf));
-
- #ifdef UNIX
- --- 46,52 ----
- static int ti_change __ARGS((char_u *str, char_u **last));
- #endif
- static void free_buffer __ARGS((buf_T *));
- ! static void free_buffer_stuff __ARGS((buf_T *buf, int free_options));
- static void clear_wininfo __ARGS((buf_T *buf));
-
- #ifdef UNIX
- ***************
- *** 393,399 ****
- {
- /* Free all internal variables and reset option values, to make
- * ":bdel" compatible with Vim 5.7. */
- ! free_buffer_stuff(buf);
-
- /* Make it look like a new buffer. */
- buf->b_flags = BF_CHECK_RO | BF_NEVERLOADED;
- --- 393,399 ----
- {
- /* Free all internal variables and reset option values, to make
- * ":bdel" compatible with Vim 5.7. */
- ! free_buffer_stuff(buf, TRUE);
-
- /* Make it look like a new buffer. */
- buf->b_flags = BF_CHECK_RO | BF_NEVERLOADED;
- ***************
- *** 481,487 ****
- free_buffer(buf)
- buf_T *buf;
- {
- ! free_buffer_stuff(buf);
- #ifdef FEAT_PERL
- perl_buf_free(buf);
- #endif
- --- 481,487 ----
- free_buffer(buf)
- buf_T *buf;
- {
- ! free_buffer_stuff(buf, TRUE);
- #ifdef FEAT_PERL
- perl_buf_free(buf);
- #endif
- ***************
- *** 498,518 ****
- * Free stuff in the buffer for ":bdel" and when wiping out the buffer.
- */
- static void
- ! free_buffer_stuff(buf)
- buf_T *buf;
- {
- ! clear_wininfo(buf);
- #ifdef FEAT_EVAL
- ! var_clear(&buf->b_vars); /* free all internal variables */
- #endif
- #ifdef FEAT_USR_CMDS
- ! uc_clear(&buf->b_ucmds); /* clear local user commands */
- #ifdef FEAT_LOCALMAP
- map_clear_int(buf, MAP_ALL_MODES, TRUE, FALSE); /* clear local mappings */
- map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE); /* clear local abbrevs */
- #endif
- - #endif
- - free_buf_options(buf, TRUE);
- #ifdef FEAT_MBYTE
- vim_free(buf->b_start_fenc);
- buf->b_start_fenc = NULL;
- --- 498,522 ----
- * Free stuff in the buffer for ":bdel" and when wiping out the buffer.
- */
- static void
- ! free_buffer_stuff(buf, free_options)
- buf_T *buf;
- + int free_options; /* free options as well */
- {
- ! if (free_options)
- ! {
- ! clear_wininfo(buf); /* including window-local options */
- ! free_buf_options(buf, TRUE);
- ! }
- #ifdef FEAT_EVAL
- ! var_clear(&buf->b_vars); /* free all internal variables */
- #endif
- #ifdef FEAT_USR_CMDS
- ! uc_clear(&buf->b_ucmds); /* clear local user commands */
- ! #endif
- #ifdef FEAT_LOCALMAP
- map_clear_int(buf, MAP_ALL_MODES, TRUE, FALSE); /* clear local mappings */
- map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE); /* clear local abbrevs */
- #endif
- #ifdef FEAT_MBYTE
- vim_free(buf->b_start_fenc);
- buf->b_start_fenc = NULL;
- ***************
- *** 1290,1297 ****
- if (buf != curbuf) /* autocommands deleted the buffer! */
- return NULL;
- /* buf->b_nwindows = 0; why was this here? */
- ! #ifdef FEAT_EVAL
- ! var_clear(&buf->b_vars); /* delete internal variables */
- #endif
- }
- else
- --- 1294,1303 ----
- if (buf != curbuf) /* autocommands deleted the buffer! */
- return NULL;
- /* buf->b_nwindows = 0; why was this here? */
- ! free_buffer_stuff(buf, FALSE); /* delete local variables et al. */
- ! #ifdef FEAT_KEYMAP
- ! /* need to reload lmaps and set b:keymap_name */
- ! curbuf->b_kmap_state |= KEYMAP_INIT;
- #endif
- }
- else
- *** ../vim60.140/src/version.c Thu Jan 17 11:00:13 2002
- --- src/version.c Thu Jan 17 10:59:19 2002
- ***************
- *** 608,609 ****
- --- 608,611 ----
- { /* Add new patch number below this line */
- + /**/
- + 141,
- /**/
-
- --
- hundred-and-one symptoms of being an internet addict:
- 21. Your dog has its own home page.
-
- /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\
- ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim )))
- \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
-