To: vim-dev@vim.org Subject: Patch 6.1.449 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.449 Problem: When "1" and "a" are in 'formatoptions', auto-formatting always moves a newly added character to the next line. (Servatius Brandt) Solution: Don't move a single character to the next line when it was just typed. Files: src/edit.c *** ../vim61.448/src/edit.c Sat Mar 15 17:55:18 2003 --- src/edit.c Sun Apr 6 15:48:38 2003 *************** *** 4343,4351 **** old = ml_get_curline(); /* Don't format in Insert mode when the cursor is on a trailing blank, the ! * user might insert normal text next. */ ! if (*old != NUL && pos.col == STRLEN(old) && vim_iswhite(old[pos.col - 1])) ! return; #ifdef FEAT_COMMENTS /* With the 'c' flag in 'formatoptions' only format comments. */ --- 4343,4366 ---- old = ml_get_curline(); /* Don't format in Insert mode when the cursor is on a trailing blank, the ! * user might insert normal text next. Also skip formatting when "1" is ! * in 'formatoptions' and there is a single character before the cursor. ! * Otherwise the line would be broken and when typing another non-white ! * next they are not joined back together. */ ! if (*old != NUL && pos.col == STRLEN(old)) ! { ! dec_cursor(); ! if (!WHITECHAR(gchar_cursor()) ! && curwin->w_cursor.col > 0 ! && has_format_option(FO_ONE_LETTER)) ! dec_cursor(); ! if (WHITECHAR(gchar_cursor())) ! { ! curwin->w_cursor = pos; ! return; ! } ! curwin->w_cursor = pos; ! } #ifdef FEAT_COMMENTS /* With the 'c' flag in 'formatoptions' only format comments. */ *** ../vim61.448/src/version.c Sun Apr 6 15:22:34 2003 --- src/version.c Sun Apr 6 16:16:09 2003 *************** *** 613,614 **** --- 613,616 ---- { /* Add new patch number below this line */ + /**/ + 449, /**/ -- Vi beats Emacs to death, and then again! http://linuxtoday.com/stories/5764.html /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///