Skip to content

Instantly share code, notes, and snippets.

@mattn
Created January 28, 2012 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattn/1694609 to your computer and use it in GitHub Desktop.
Save mattn/1694609 to your computer and use it in GitHub Desktop.
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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment