I got a bug report about behavior of "." register in compatible mode. When typed commands fail with "an Empty region", original behavior is that don't store last commands to "." register.
For example: vim -u NONE :set cpoptions+=E afoo<ESC>0c0 You will get beep. This mean "an Empty region". If you type ".", you'll get an error again. But traditional vi's behavior is repeat of append "foo". Then text should be: ffoooo Another example: vim -u NONE :set cpoptions+=E ahoge<ESC>c0:q!<CR><ESC> Text will be: q! e Then, type "." Original vi's behavior will not do anything. But vim will exit. This cause that vim don't clear "." register when error occur. Below is a patch. Please check and include. This patch is written by Hideki EIRAKU. https://gist.github.com/1694609 (https://raw.github.com/gist/1694609/fix-compatible-dot-behavior.diff) diff -ur vim/src/getchar.c hdk1983-vim/src/getchar.c --- vim/src/getchar.c 2012-01-15 22:06:34.240016219 +0900 +++ hdk1983-vim/src/getchar.c 2012-01-28 23:11:36.900123501 +0900 @@ -470,6 +470,20 @@ } } + void +CancelRedo() +{ + if (!block_redo) + { + free_buff(&redobuff); + redobuff = old_redobuff; + old_redobuff.bh_first.b_next = NULL; + start_stuff(); + while (read_stuff(TRUE) != NUL) + ; + } +} + #if defined(FEAT_AUTOCMD) || defined(FEAT_EVAL) || defined(PROTO) /* * Save redobuff and old_redobuff to save_redobuff and save_old_redobuff. diff -ur vim/src/normal.c hdk1983-vim/src/normal.c --- vim/src/normal.c 2012-01-28 22:57:38.583873667 +0900 +++ hdk1983-vim/src/normal.c 2012-01-28 23:11:37.004047958 +0900 @@ -1978,7 +1978,10 @@ VIsual_reselect = FALSE; /* don't reselect now */ #endif if (empty_region_error) + { vim_beep(); + CancelRedo(); + } else { (void)op_delete(oap); @@ -1992,7 +1995,10 @@ if (empty_region_error) { if (!gui_yank) + { vim_beep(); + CancelRedo(); + } } else (void)op_yank(oap, FALSE, !gui_yank); @@ -2004,7 +2010,10 @@ VIsual_reselect = FALSE; /* don't reselect now */ #endif if (empty_region_error) + { vim_beep(); + CancelRedo(); + } else { /* This is a new edit command, not a restart. Need to @@ -2066,7 +2075,10 @@ case OP_LOWER: case OP_ROT13: if (empty_region_error) + { vim_beep(); + CancelRedo(); + } else op_tilde(oap); check_cursor_col(); @@ -2099,7 +2111,10 @@ #endif #ifdef FEAT_VISUALEXTRA if (empty_region_error) + { vim_beep(); + CancelRedo(); + } else { /* This is a new edit command, not a restart. Need to @@ -2129,7 +2144,10 @@ #ifdef FEAT_VISUALEXTRA if (empty_region_error) #endif + { vim_beep(); + CancelRedo(); + } #ifdef FEAT_VISUALEXTRA else op_replace(oap, cap->nchar); -- Yasuhiro Matsumoto -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
