To: vim_dev@googlegroups.com Subject: Patch 9.0.1362 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1362 Problem: ml_get error when going to another tab. (Daniel J. Perry) Solution: Do not call update_topline() if "curwin" is invalid. (closes #11907) Files: src/window.c, src/testdir/test_tabpage.vim *** ../vim-9.0.1361/src/window.c 2023-02-21 14:27:34.528360386 +0000 --- src/window.c 2023-02-27 17:16:23.094212304 +0000 *************** *** 5273,5287 **** int curwin_invalid = (flags & WEE_CURWIN_INVALID); int did_decrement = FALSE; ! if (wp == curwin && !curwin_invalid) // nothing to do return FALSE; #ifdef FEAT_JOB_CHANNEL ! if (!curwin_invalid) leaving_window(curwin); #endif ! if (!curwin_invalid && (flags & WEE_TRIGGER_LEAVE_AUTOCMDS)) { /* * Be careful: If autocommands delete the window, return now. --- 5273,5287 ---- int curwin_invalid = (flags & WEE_CURWIN_INVALID); int did_decrement = FALSE; ! if (wp == curwin && curwin_invalid == 0) // nothing to do return FALSE; #ifdef FEAT_JOB_CHANNEL ! if (curwin_invalid == 0) leaving_window(curwin); #endif ! if (curwin_invalid == 0 && (flags & WEE_TRIGGER_LEAVE_AUTOCMDS)) { /* * Be careful: If autocommands delete the window, return now. *************** *** 5309,5321 **** // Might need to scroll the old window before switching, e.g., when the // cursor was moved. ! if (*p_spk == 'c') update_topline(); // may have to copy the buffer options when 'cpo' contains 'S' if (wp->w_buffer != curbuf) buf_copy_options(wp->w_buffer, BCO_ENTER | BCO_NOHELP); ! if (!curwin_invalid) { prevwin = curwin; // remember for CTRL-W p curwin->w_redr_status = TRUE; --- 5309,5321 ---- // Might need to scroll the old window before switching, e.g., when the // cursor was moved. ! if (*p_spk == 'c' && curwin_invalid == 0) update_topline(); // may have to copy the buffer options when 'cpo' contains 'S' if (wp->w_buffer != curbuf) buf_copy_options(wp->w_buffer, BCO_ENTER | BCO_NOHELP); ! if (curwin_invalid == 0) { prevwin = curwin; // remember for CTRL-W p curwin->w_redr_status = TRUE; *** ../vim-9.0.1361/src/testdir/test_tabpage.vim 2022-10-15 20:52:22.559752564 +0100 --- src/testdir/test_tabpage.vim 2023-02-27 17:15:19.942184463 +0000 *************** *** 872,875 **** --- 872,890 ---- call assert_equal(1, tabpagenr('$')) endfunc + " this was giving ml_get errors + func Test_tabpage_last_line() + enew + call setline(1, repeat(['a'], &lines + 5)) + $ + tabnew + call setline(1, repeat(['b'], &lines + 20)) + $ + tabNext + call assert_equal('a', getline('.')) + + bwipe! + bwipe! + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-9.0.1361/src/version.c 2023-02-27 14:59:53.266085290 +0000 --- src/version.c 2023-02-27 17:12:46.390115903 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1362, /**/ -- hundred-and-one symptoms of being an internet addict: 190. You quickly hand over your wallet, leather jacket, and car keys during a mugging, then proceed to beat the crap out of your assailant when he asks for your laptop. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///