To: vim-dev@vim.org Subject: Patch 6.0.065 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.065 Problem: When using ":normal" in 'indentexpr' it may use redo characters before its argument. (Neil Bird) Solution: Save and restore the stuff buffer in ex_normal(). Files: src/ex_docmd.c, src/getchar.c, src/globals.h, src/structs.h *** ../vim60.64/src/ex_docmd.c Tue Oct 30 21:18:36 2001 --- src/ex_docmd.c Fri Nov 2 16:14:07 2001 *************** *** 6805,6810 **** --- 6805,6811 ---- typebuf_T saved_typebuf; int save_insertmode = p_im; int save_finish_op = finish_op; + struct buffheader save_stuffbuff; #ifdef FEAT_MBYTE char_u *arg = NULL; int l; *************** *** 6894,6899 **** --- 6895,6904 ---- saved_typebuf = typebuf; if (alloc_typebuf() == OK) { + /* Also save the stuff buffer and make it empty. */ + save_stuffbuff = stuffbuff; + stuffbuff.bh_first.b_next = NULL; + /* * Repeat the :normal command for each line in the range. When no * range given, execute it just once, without positioning the cursor *************** *** 6927,6932 **** --- 6932,6939 ---- } } while (eap->addr_count > 0 && eap->line1 <= eap->line2 && !got_int); + + stuffbuff = save_stuffbuff; } /* Might not return to the main loop when in an event handler. */ *** ../vim60.64/src/getchar.c Sun Oct 28 21:23:45 2001 --- src/getchar.c Fri Nov 2 16:23:29 2001 *************** *** 38,66 **** * Un-escaping is done by vgetc(). */ - /* - * structure used to store one block of the stuff/redo/recording buffers - */ - struct buffblock - { - struct buffblock *b_next; /* pointer to next buffblock */ - char_u b_str[1]; /* contents (actually longer) */ - }; - #define MINIMAL_SIZE 20 /* minimal size for b_str */ - /* - * header used for the stuff buffer and the redo buffer - */ - struct buffheader - { - struct buffblock bh_first; /* first (dummy) block of list */ - struct buffblock *bh_curr; /* buffblock for appending */ - int bh_index; /* index for reading */ - int bh_space; /* space in bh_curr for appending */ - }; - - static struct buffheader stuffbuff = {{NULL, {NUL}}, NULL, 0, 0}; static struct buffheader redobuff = {{NULL, {NUL}}, NULL, 0, 0}; static struct buffheader old_redobuff = {{NULL, {NUL}}, NULL, 0, 0}; #if defined(FEAT_AUTOCMD) || defined(FEAT_EVAL) || defined(PROTO) --- 38,45 ---- *** ../vim60.64/src/globals.h Sun Oct 28 21:23:45 2001 --- src/globals.h Fri Nov 2 16:07:27 2001 *************** *** 693,702 **** EXTERN int readonlymode INIT(= FALSE); /* Set to TRUE for "view" */ EXTERN int recoverymode INIT(= FALSE); /* Set to TRUE for "-r" option */ EXTERN typebuf_T typebuf /* typeahead buffer */ ! # ifdef DO_INIT = {NULL, NULL} ! # endif ; #ifdef FEAT_EX_EXTRA EXTERN int ex_normal_busy INIT(= 0); /* recursivenes of ex_normal() */ --- 693,707 ---- EXTERN int readonlymode INIT(= FALSE); /* Set to TRUE for "view" */ EXTERN int recoverymode INIT(= FALSE); /* Set to TRUE for "-r" option */ + EXTERN struct buffheader stuffbuff /* stuff buffer */ + #ifdef DO_INIT + = {{NULL, {NUL}}, NULL, 0, 0} + #endif + ; EXTERN typebuf_T typebuf /* typeahead buffer */ ! #ifdef DO_INIT = {NULL, NULL} ! #endif ; #ifdef FEAT_EX_EXTRA EXTERN int ex_normal_busy INIT(= 0); /* recursivenes of ex_normal() */ *** ../vim60.64/src/structs.h Wed Oct 31 11:17:27 2001 --- src/structs.h Fri Nov 2 16:23:11 2001 *************** *** 338,343 **** --- 338,363 ---- }; /* + * structure used to store one block of the stuff/redo/recording buffers + */ + struct buffblock + { + struct buffblock *b_next; /* pointer to next buffblock */ + char_u b_str[1]; /* contents (actually longer) */ + }; + + /* + * header used for the stuff buffer and the redo buffer + */ + struct buffheader + { + struct buffblock bh_first; /* first (dummy) block of list */ + struct buffblock *bh_curr; /* buffblock for appending */ + int bh_index; /* index for reading */ + int bh_space; /* space in bh_curr for appending */ + }; + + /* * used for completion on the command line */ typedef struct expand *** ../vim60.64/src/version.c Fri Nov 2 16:20:26 2001 --- src/version.c Fri Nov 2 16:19:23 2001 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 65, /**/ -- FIRST VILLAGER: We have found a witch. May we burn her? "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// 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 ///