mirror of
https://github.com/neovim/neovim.git
synced 2025-09-17 16:58:17 +00:00
vim-patch:8.0.1427: the :leftabove modifier doesn't work for :copen
Problem: The :leftabove modifier doesn't work for :copen.
Solution: Respect the split modifier. (Yegappan Lakshmanan, closes vim/vim#2496)
de04654ddc
This commit is contained in:
@@ -2661,6 +2661,8 @@ void ex_copen(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
int flags = 0;
|
||||||
|
|
||||||
qf_buf = qf_find_buf(qi);
|
qf_buf = qf_find_buf(qi);
|
||||||
|
|
||||||
/* The current window becomes the previous window afterwards. */
|
/* The current window becomes the previous window afterwards. */
|
||||||
@@ -2668,11 +2670,17 @@ void ex_copen(exarg_T *eap)
|
|||||||
|
|
||||||
if ((eap->cmdidx == CMD_copen || eap->cmdidx == CMD_cwindow)
|
if ((eap->cmdidx == CMD_copen || eap->cmdidx == CMD_cwindow)
|
||||||
&& cmdmod.split == 0)
|
&& cmdmod.split == 0)
|
||||||
/* Create the new window at the very bottom, except when
|
// Create the new quickfix window at the very bottom, except when
|
||||||
* :belowright or :aboveleft is used. */
|
// :belowright or :aboveleft is used.
|
||||||
win_goto(lastwin);
|
win_goto(lastwin);
|
||||||
if (win_split(height, WSP_BELOW | WSP_NEWLOC) == FAIL)
|
// Default is to open the window below the current window
|
||||||
return; /* not enough room for window */
|
if (cmdmod.split == 0) {
|
||||||
|
flags = WSP_BELOW;
|
||||||
|
}
|
||||||
|
flags |= WSP_NEWLOC;
|
||||||
|
if (win_split(height, flags) == FAIL) {
|
||||||
|
return; // not enough room for window
|
||||||
|
}
|
||||||
RESET_BINDING(curwin);
|
RESET_BINDING(curwin);
|
||||||
|
|
||||||
if (eap->cmdidx == CMD_lopen || eap->cmdidx == CMD_lwindow) {
|
if (eap->cmdidx == CMD_lopen || eap->cmdidx == CMD_lwindow) {
|
||||||
|
@@ -2637,3 +2637,30 @@ func Test_shorten_fname()
|
|||||||
silent! clist
|
silent! clist
|
||||||
call assert_equal('test_quickfix.vim', bufname('test_quickfix.vim'))
|
call assert_equal('test_quickfix.vim', bufname('test_quickfix.vim'))
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" Test for the position of the quickfix and location list window
|
||||||
|
func Test_qfwin_pos()
|
||||||
|
" Open two windows
|
||||||
|
new | only
|
||||||
|
new
|
||||||
|
cexpr ['F1:10:L10']
|
||||||
|
copen
|
||||||
|
" Quickfix window should be the bottom most window
|
||||||
|
call assert_equal(3, winnr())
|
||||||
|
close
|
||||||
|
" Open at the very top
|
||||||
|
wincmd t
|
||||||
|
topleft copen
|
||||||
|
call assert_equal(1, winnr())
|
||||||
|
close
|
||||||
|
" open left of the current window
|
||||||
|
wincmd t
|
||||||
|
below new
|
||||||
|
leftabove copen
|
||||||
|
call assert_equal(2, winnr())
|
||||||
|
close
|
||||||
|
" open right of the current window
|
||||||
|
rightbelow copen
|
||||||
|
call assert_equal(3, winnr())
|
||||||
|
close
|
||||||
|
endfunc
|
||||||
|
Reference in New Issue
Block a user