diff options
author | Bram Moolenaar <Bram@vim.org> | 2010-08-07 12:54:12 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2010-08-07 12:54:12 +0200 |
commit | 0390ded91baaaf1a699a3b77d02de595e8d8659a (patch) | |
tree | 636bc2e21ede71516cf571e7f19c2398e6d1ac9e /src/undo.c | |
parent | c3d2c4478de4819349291a919b68426ef615ed3f (diff) | |
download | vim-git-0390ded91baaaf1a699a3b77d02de595e8d8659a.tar.gz |
Fix: ml_get errors when using undo with 'virtualedit'.
Diffstat (limited to 'src/undo.c')
-rw-r--r-- | src/undo.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/undo.c b/src/undo.c index 1b7419725..376913d53 100644 --- a/src/undo.c +++ b/src/undo.c @@ -2591,18 +2591,21 @@ u_undoredo(undo) if (curhead->uh_cursor.lnum + 1 == curwin->w_cursor.lnum && curwin->w_cursor.lnum > 1) --curwin->w_cursor.lnum; - if (curhead->uh_cursor.lnum == curwin->w_cursor.lnum) + if (curwin->w_cursor.lnum <= curbuf->b_ml.ml_line_count) { - curwin->w_cursor.col = curhead->uh_cursor.col; + if (curhead->uh_cursor.lnum == curwin->w_cursor.lnum) + { + curwin->w_cursor.col = curhead->uh_cursor.col; #ifdef FEAT_VIRTUALEDIT - if (virtual_active() && curhead->uh_cursor_vcol >= 0) - coladvance((colnr_T)curhead->uh_cursor_vcol); - else - curwin->w_cursor.coladd = 0; + if (virtual_active() && curhead->uh_cursor_vcol >= 0) + coladvance((colnr_T)curhead->uh_cursor_vcol); + else + curwin->w_cursor.coladd = 0; #endif + } + else + beginline(BL_SOL | BL_FIX); } - else if (curwin->w_cursor.lnum <= curbuf->b_ml.ml_line_count) - beginline(BL_SOL | BL_FIX); else { /* We get here with the current cursor line being past the end (eg |