mirror of
https://github.com/neovim/neovim.git
synced 2025-09-09 21:08:17 +00:00
Return bool from find_win_for_buf #1023
This commit is contained in:

committed by
Justin M. Keyes

parent
8fa4abf15a
commit
3599a834d5
@@ -490,7 +490,7 @@ static void switch_to_win_for_buf(buf_T *buf,
|
|||||||
win_T *wp;
|
win_T *wp;
|
||||||
tabpage_T *tp;
|
tabpage_T *tp;
|
||||||
|
|
||||||
if (find_win_for_buf(buf, &wp, &tp) == FAIL
|
if (!find_win_for_buf(buf, &wp, &tp)
|
||||||
|| switch_win(save_curwinp, save_curtabp, wp, tp, true) == FAIL)
|
|| switch_win(save_curwinp, save_curtabp, wp, tp, true) == FAIL)
|
||||||
switch_buffer(save_curbufp, buf);
|
switch_buffer(save_curbufp, buf);
|
||||||
}
|
}
|
||||||
|
@@ -4246,7 +4246,7 @@ char_u *buf_spname(buf_T *buf)
|
|||||||
* For location list window, w_llist_ref points to the location list.
|
* For location list window, w_llist_ref points to the location list.
|
||||||
* For quickfix window, w_llist_ref is NULL.
|
* For quickfix window, w_llist_ref is NULL.
|
||||||
*/
|
*/
|
||||||
if (find_win_for_buf(buf, &win, &tp) == OK && win->w_llist_ref != NULL)
|
if (find_win_for_buf(buf, &win, &tp) && win->w_llist_ref != NULL)
|
||||||
return (char_u *)_(msg_loclist);
|
return (char_u *)_(msg_loclist);
|
||||||
else
|
else
|
||||||
return (char_u *)_(msg_qflist);
|
return (char_u *)_(msg_qflist);
|
||||||
@@ -4265,17 +4265,17 @@ char_u *buf_spname(buf_T *buf)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Find a window for buffer "buf".
|
* Find a window for buffer "buf".
|
||||||
* If found OK is returned and "wp" and "tp" are set to the window and tabpage.
|
* If found true is returned and "wp" and "tp" are set to the window and tabpage.
|
||||||
* If not found FAIL is returned.
|
* If not found false is returned.
|
||||||
*/
|
*/
|
||||||
int find_win_for_buf(buf_T *buf, win_T **wp, tabpage_T **tp)
|
bool find_win_for_buf(buf_T *buf, win_T **wp, tabpage_T **tp)
|
||||||
{
|
{
|
||||||
FOR_ALL_TAB_WINDOWS(*tp, *wp) {
|
FOR_ALL_TAB_WINDOWS(*tp, *wp) {
|
||||||
if ((*wp)->w_buffer == buf) {
|
if ((*wp)->w_buffer == buf) {
|
||||||
return OK;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FAIL;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user