To: vim-dev@vim.org Subject: Patch 6.1.350 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.350 Problem: When entering a buffer with ":bnext" for the first time, using an autocommand to restore the last used cursor position doesn't work. (Paolo Giarusso) Solution: Don't use the last known cursor position of the current Vim invocation if an autocommand changed the position. Files: src/buffer.c *** ../vim61.349/src/buffer.c Wed Jan 29 22:08:43 2003 --- src/buffer.c Tue Feb 18 20:11:05 2003 *************** *** 1165,1170 **** --- 1199,1212 ---- diff_new_buffer(); #endif + /* Cursor on first line by default. */ + curwin->w_cursor.lnum = 1; + curwin->w_cursor.col = 0; + #ifdef FEAT_VIRTUALEDIT + curwin->w_cursor.coladd = 0; + #endif + curwin->w_set_curswant = TRUE; + /* Make sure the buffer is loaded. */ if (curbuf->b_ml.ml_mfp == NULL) /* need to load the file */ open_buffer(FALSE, NULL); *************** *** 1181,1188 **** apply_autocmds(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf); #endif } ! buflist_getfpos(); /* restore curpos.lnum and possibly ! * curpos.col */ check_arg_idx(curwin); /* check for valid arg_idx */ #ifdef FEAT_TITLE maketitle(); --- 1223,1234 ---- apply_autocmds(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf); #endif } ! ! /* If autocommands did not change the cursor position, restore cursor lnum ! * and possibly cursor col. */ ! if (curwin->w_cursor.lnum == 1 && curwin->w_cursor.col == 0) ! buflist_getfpos(); ! check_arg_idx(curwin); /* check for valid arg_idx */ #ifdef FEAT_TITLE maketitle(); *** ../vim61.349/src/version.c Thu Feb 20 21:54:31 2003 --- src/version.c Thu Feb 20 22:00:41 2003 *************** *** 608,609 **** --- 612,615 ---- { /* Add new patch number below this line */ + /**/ + 350, /**/ -- Veni, Vidi, Video -- I came, I saw, I taped what I saw. /// 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 ///