patch 7.4.2010
Problem: There is a :cbottom command but no :lbottom command.
Solution: Add :lbottom. (Yegappan Lakshmanan)
diff --git a/src/ex_cmds.h b/src/ex_cmds.h
index 8c64d33..f57adc0d 100644
--- a/src/ex_cmds.h
+++ b/src/ex_cmds.h
@@ -724,6 +724,9 @@
EX(CMD_later, "later", ex_later,
TRLBAR|EXTRA|NOSPC|CMDWIN,
ADDR_LINES),
+EX(CMD_lbottom, "lbottom", ex_cbottom,
+ TRLBAR,
+ ADDR_LINES),
EX(CMD_lbuffer, "lbuffer", ex_cbuffer,
BANG|RANGE|NOTADR|WORD1|TRLBAR,
ADDR_LINES),
diff --git a/src/quickfix.c b/src/quickfix.c
index 45659a0..92a0204 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -2831,13 +2831,25 @@
}
/*
- * :cbottom command.
+ * :cbottom/:lbottom commands.
*/
void
ex_cbottom(exarg_T *eap UNUSED)
{
- win_T *win = qf_find_win(&ql_info);
+ qf_info_T *qi = &ql_info;
+ win_T *win;
+ if (eap->cmdidx == CMD_lbottom)
+ {
+ qi = GET_LOC_LIST(curwin);
+ if (qi == NULL)
+ {
+ EMSG(_(e_loclist));
+ return;
+ }
+ }
+
+ win = qf_find_win(qi);
if (win != NULL && win->w_cursor.lnum != win->w_buffer->b_ml.ml_line_count)
qf_win_goto(win, win->w_buffer->b_ml.ml_line_count);
}
diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim
index 01e2110..39f788e 100644
--- a/src/testdir/test_quickfix.vim
+++ b/src/testdir/test_quickfix.vim
@@ -15,6 +15,7 @@
command! -nargs=* Xnewer <mods>cnewer <args>
command! -nargs=* Xopen <mods>copen <args>
command! -nargs=* Xwindow <mods>cwindow <args>
+ command! -nargs=* Xbottom <mods>cbottom <args>
command! -nargs=* Xclose <mods>cclose <args>
command! -nargs=* -bang Xfile <mods>cfile<bang> <args>
command! -nargs=* Xgetfile <mods>cgetfile <args>
@@ -44,6 +45,7 @@
command! -nargs=* Xnewer <mods>lnewer <args>
command! -nargs=* Xopen <mods>lopen <args>
command! -nargs=* Xwindow <mods>lwindow <args>
+ command! -nargs=* Xbottom <mods>lbottom <args>
command! -nargs=* Xclose <mods>lclose <args>
command! -nargs=* -bang Xfile <mods>lfile<bang> <args>
command! -nargs=* Xgetfile <mods>lgetfile <args>
@@ -200,6 +202,7 @@
Xwindow
call assert_true(winnr('$') == 2 && winnr() == 2 &&
\ getline('.') ==# 'Xtestfile1|1 col 3| Line1')
+ redraw!
" Close the window
Xclose
@@ -1415,15 +1418,23 @@
call delete('Xtwo', 'rf')
endfunc
-function Test_cbottom()
- call setqflist([{'filename': 'foo', 'lnum': 42}])
- copen
+function XbottomTests(cchar)
+ call s:setup_commands(a:cchar)
+
+ call g:Xsetlist([{'filename': 'foo', 'lnum': 42}])
+ Xopen
let wid = win_getid()
call assert_equal(1, line('.'))
wincmd w
- call setqflist([{'filename': 'var', 'lnum': 24}], 'a')
- cbottom
+ call g:Xsetlist([{'filename': 'var', 'lnum': 24}], 'a')
+ Xbottom
call win_gotoid(wid)
call assert_equal(2, line('.'))
- cclose
+ Xclose
endfunc
+
+" Tests for the :cbottom and :lbottom commands
+function Test_cbottom()
+ call XbottomTests('c')
+ call XbottomTests('l')
+endfunction
diff --git a/src/version.c b/src/version.c
index 08675cd..b0969bd 100644
--- a/src/version.c
+++ b/src/version.c
@@ -759,6 +759,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2010,
+/**/
2009,
/**/
2008,