comparison src/undo.c @ 2501:c43e99e9baaf vim73

Fix: ml_get errors when using undo with 'virtualedit'.
author Bram Moolenaar <bram@vim.org>
date Sat, 07 Aug 2010 12:54:12 +0200
parents 88751831fa0a
children 073ff46fe397
comparison
equal deleted inserted replaced
2500:2649a1882e95 2501:c43e99e9baaf
2589 * Otherwise the cursor should go to the first undone line. 2589 * Otherwise the cursor should go to the first undone line.
2590 */ 2590 */
2591 if (curhead->uh_cursor.lnum + 1 == curwin->w_cursor.lnum 2591 if (curhead->uh_cursor.lnum + 1 == curwin->w_cursor.lnum
2592 && curwin->w_cursor.lnum > 1) 2592 && curwin->w_cursor.lnum > 1)
2593 --curwin->w_cursor.lnum; 2593 --curwin->w_cursor.lnum;
2594 if (curhead->uh_cursor.lnum == curwin->w_cursor.lnum) 2594 if (curwin->w_cursor.lnum <= curbuf->b_ml.ml_line_count)
2595 { 2595 {
2596 curwin->w_cursor.col = curhead->uh_cursor.col; 2596 if (curhead->uh_cursor.lnum == curwin->w_cursor.lnum)
2597 {
2598 curwin->w_cursor.col = curhead->uh_cursor.col;
2597 #ifdef FEAT_VIRTUALEDIT 2599 #ifdef FEAT_VIRTUALEDIT
2598 if (virtual_active() && curhead->uh_cursor_vcol >= 0) 2600 if (virtual_active() && curhead->uh_cursor_vcol >= 0)
2599 coladvance((colnr_T)curhead->uh_cursor_vcol); 2601 coladvance((colnr_T)curhead->uh_cursor_vcol);
2602 else
2603 curwin->w_cursor.coladd = 0;
2604 #endif
2605 }
2600 else 2606 else
2601 curwin->w_cursor.coladd = 0; 2607 beginline(BL_SOL | BL_FIX);
2602 #endif 2608 }
2603 }
2604 else if (curwin->w_cursor.lnum <= curbuf->b_ml.ml_line_count)
2605 beginline(BL_SOL | BL_FIX);
2606 else 2609 else
2607 { 2610 {
2608 /* We get here with the current cursor line being past the end (eg 2611 /* We get here with the current cursor line being past the end (eg
2609 * after adding lines at the end of the file, and then undoing it). 2612 * after adding lines at the end of the file, and then undoing it).
2610 * check_cursor() will move the cursor to the last line. Move it to 2613 * check_cursor() will move the cursor to the last line. Move it to