Skip to content

Instantly share code, notes, and snippets.

@mattn
Created February 28, 2013 05:43
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/5054510 to your computer and use it in GitHub Desktop.
Save mattn/5054510 to your computer and use it in GitHub Desktop.
diff -r 8b86b69546a9 src/ops.c
--- a/src/ops.c Wed Feb 20 21:26:00 2013 +0100
+++ b/src/ops.c Thu Feb 28 14:41:31 2013 +0900
@@ -2194,7 +2194,9 @@
{
/* This is slow, but it handles replacing a single-byte
* with a multi-byte and the other way around. */
- oap->end.col += (*mb_char2len)(c) - (*mb_char2len)(n);
+
+ if (curwin->w_cursor.lnum == oap->end.lnum)
+ oap->end.col += (*mb_char2len)(c) - (*mb_char2len)(n);
n = State;
State = REPLACE;
ins_char(c);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment