mirror of
https://github.com/neovim/neovim.git
synced 2025-10-01 15:38:33 +00:00
vim-patch:7.4.2212
Problem: Mark " is not set when closing a window in another tab. (Guraga)
Solution: Check all tabs for the window to be valid. (based on patch by
Hirohito Higashi, closes vim/vim#974)
e59215c7dc
This commit is contained in:
@@ -323,7 +323,7 @@ void close_buffer(win_T *win, buf_T *buf, int action, int abort_if_last)
|
|||||||
wipe_buf = true;
|
wipe_buf = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (win_valid(win)) {
|
if (win_valid_any_tab(win)) {
|
||||||
/* Set b_last_cursor when closing the last window for the buffer.
|
/* Set b_last_cursor when closing the last window for the buffer.
|
||||||
* Remember the last cursor position and window options of the buffer.
|
* Remember the last cursor position and window options of the buffer.
|
||||||
* This used to be only for the current window, but then options like
|
* This used to be only for the current window, but then options like
|
||||||
@@ -402,7 +402,7 @@ void close_buffer(win_T *win, buf_T *buf, int action, int abort_if_last)
|
|||||||
buf->b_nwindows = nwindows;
|
buf->b_nwindows = nwindows;
|
||||||
|
|
||||||
buf_freeall(buf, (del_buf ? BFA_DEL : 0) + (wipe_buf ? BFA_WIPE : 0));
|
buf_freeall(buf, (del_buf ? BFA_DEL : 0) + (wipe_buf ? BFA_WIPE : 0));
|
||||||
if (win_valid(win) && win->w_buffer == buf) {
|
if (win_valid_any_tab(win) && win->w_buffer == buf) {
|
||||||
win->w_buffer = NULL; // make sure we don't use the buffer now
|
win->w_buffer = NULL; // make sure we don't use the buffer now
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -229,7 +229,7 @@ static int included_patches[] = {
|
|||||||
// 2215,
|
// 2215,
|
||||||
// 2214 NA
|
// 2214 NA
|
||||||
2213,
|
2213,
|
||||||
// 2212,
|
2212,
|
||||||
// 2211 NA
|
// 2211 NA
|
||||||
// 2210 NA
|
// 2210 NA
|
||||||
// 2209,
|
// 2209,
|
||||||
|
@@ -1065,6 +1065,23 @@ bool win_valid(win_T *win) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Check if "win" is a pointer to an existing window in any tabpage.
|
||||||
|
///
|
||||||
|
/// @param win window to check
|
||||||
|
bool win_valid_any_tab(win_T *win) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
|
||||||
|
{
|
||||||
|
if (win == NULL) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
FOR_ALL_TAB_WINDOWS(tp, wp) {
|
||||||
|
if (wp == win) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return the number of windows.
|
* Return the number of windows.
|
||||||
*/
|
*/
|
||||||
|
@@ -102,6 +102,18 @@ describe('ShaDa support code', function()
|
|||||||
eq(2, nvim_current_line())
|
eq(2, nvim_current_line())
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('is able to dump and read back mark " from a closed tab', function()
|
||||||
|
nvim_command('edit ' .. testfilename)
|
||||||
|
nvim_command('edit ' .. testfilename_2)
|
||||||
|
nvim_command('2')
|
||||||
|
nvim_command('q!')
|
||||||
|
nvim_command('qall')
|
||||||
|
reset()
|
||||||
|
nvim_command('edit ' .. testfilename_2)
|
||||||
|
nvim_command('normal! `"')
|
||||||
|
eq(2, nvim_current_line())
|
||||||
|
end)
|
||||||
|
|
||||||
it('is able to populate v:oldfiles', function()
|
it('is able to populate v:oldfiles', function()
|
||||||
nvim_command('edit ' .. testfilename)
|
nvim_command('edit ' .. testfilename)
|
||||||
local tf_full = curbufmeths.get_name()
|
local tf_full = curbufmeths.get_name()
|
||||||
|
Reference in New Issue
Block a user