To: vim-dev@vim.org Subject: Patch 6.1.143 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.143 (depends on 6.1.142) Problem: Auto formatting near the end of the file moves the cursor to a wrong position. In Insert mode some lines are made one char too narrow. When deleting a line undo might not always work properly. Solution: Don't always move to the end of the line in the last line. Don't position the cursor past the end of the line in Insert mode. After deleting a line save the cursor line for undo. Files: src/edit.c, src/ops.c, src/normal.c *** ../vim61.142/src/edit.c Sun Jul 28 22:02:42 2002 --- src/edit.c Tue Jul 30 19:22:21 2002 *************** *** 4256,4262 **** pold = old; while (1) { ! if (curwin->w_cursor.lnum >= curbuf->b_ml.ml_line_count) { curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count; curwin->w_cursor.col = MAXCOL; --- 4256,4262 ---- pold = old; while (1) { ! if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count) { curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count; curwin->w_cursor.col = MAXCOL; *** ../vim61.142/src/ops.c Sun Jul 28 22:02:42 2002 --- src/ops.c Thu Aug 1 20:17:00 2002 *************** *** 4200,4205 **** --- 4200,4206 ---- (void)set_indent(get_indent(), SIN_CHANGED); /* put cursor on last non-space */ + State = NORMAL; /* don't go past end-of-line */ coladvance((colnr_T)MAXCOL); while (curwin->w_cursor.col && vim_isspace(gchar_cursor())) dec_cursor(); *** ../vim61.142/src/normal.c Sun Jul 28 22:02:42 2002 --- src/normal.c Thu Aug 1 20:39:05 2002 *************** *** 1727,1732 **** --- 1727,1734 ---- else { (void)op_delete(oap); + if (oap->motion_type == MLINE && has_format_option(FO_AUTO)) + u_save_cursor(); /* cursor line wasn't saved yet */ auto_format(); } break; *** ../vim61.142/src/version.c Sun Jul 28 22:02:42 2002 --- src/version.c Thu Aug 1 20:45:20 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 143, /**/ -- From "know your smileys": (:-# Said something he shouldn't have /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ /// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\ \\\ Project leader for A-A-P -- http://www.a-a-p.org /// \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///