1
0
forked from aniani/vim

patch 9.0.1554: code for handling 'switchbuf' is repeated

Problem:    Code for handling 'switchbuf' is repeated.
Solution:   Add a function to handle 'switchbuf'. (Yegappan Lakshmanan,
            closes #12397)
This commit is contained in:
Yegappan Lakshmanan
2023-05-14 17:24:22 +01:00
committed by Bram Moolenaar
parent b6a19594b2
commit e42c27d9e8
5 changed files with 39 additions and 43 deletions

View File

@@ -3816,18 +3816,10 @@ jumpto_tag(
if (existing_buf != NULL)
{
win_T *wp = NULL;
if (swb_flags & SWB_USEOPEN)
wp = buf_jump_open_win(existing_buf);
// If 'switchbuf' contains "usetab": jump to first window in any tab
// page containing "existing_buf" if one exists
if (wp == NULL && (swb_flags & SWB_USETAB))
wp = buf_jump_open_tab(existing_buf);
// We've switched to the buffer, the usual loading of the file must
// be skipped.
if (wp != NULL)
// If 'switchbuf' is set jump to the window containing "buf".
if (swbuf_goto_win_with_buf(existing_buf) != NULL)
// We've switched to the buffer, the usual loading of the file
// must be skipped.
getfile_result = GETFILE_SAME_FILE;
}
}