aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2016-12-14 15:33:06 -0500
committerJames McCoy <jamessan@jamessan.com>2016-12-27 14:10:28 -0500
commit2c59277ca867cb3cb0144adedcfe05373d5498de (patch)
treeb0e300dd9cd10698d3f1f19641855a6a0e38a488
parentf224f3fbf11ffd3095843c597045ca95c8241fcf (diff)
downloadrneovim-2c59277ca867cb3cb0144adedcfe05373d5498de.tar.gz
rneovim-2c59277ca867cb3cb0144adedcfe05373d5498de.tar.bz2
rneovim-2c59277ca867cb3cb0144adedcfe05373d5498de.zip
vim-patch:7.4.2010
Problem: There is a :cbottom command but no :lbottom command. Solution: Add :lbottom. (Yegappan Lakshmanan) https://github.com/vim/vim/commit/537ef08408c50e0c4104d57f74993b3b0ed9560d
-rw-r--r--runtime/doc/index.txt2
-rw-r--r--runtime/doc/quickfix.txt7
-rw-r--r--src/nvim/ex_cmds.lua6
-rw-r--r--src/nvim/quickfix.c14
-rw-r--r--src/nvim/testdir/test_quickfix.vim23
-rw-r--r--src/nvim/version.c2
6 files changed, 44 insertions, 10 deletions
diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt
index bd2df5d1e5..1f4557fe30 100644
--- a/runtime/doc/index.txt
+++ b/runtime/doc/index.txt
@@ -1129,6 +1129,7 @@ tag command action ~
|:caddfile| :caddf[ile] add error message to current quickfix list
|:call| :cal[l] call a function
|:catch| :cat[ch] part of a :try command
+|:cbottom| :cbo[ttom] scroll to the bottom of the quickfix window
|:cbuffer| :cb[uffer] parse error messages and jump to first error
|:cc| :cc go to specific error
|:cclose| :ccl[ose] close quickfix window
@@ -1286,6 +1287,7 @@ tag command action ~
|:last| :la[st] go to the last file in the argument list
|:language| :lan[guage] set the language (locale)
|:later| :lat[er] go to newer change, redo
+|:lbottom| :lbo[ttom] scroll to the bottom of the location window
|:lbuffer| :lb[uffer] parse locations and jump to first location
|:lcd| :lc[d] change directory locally
|:lchdir| :lch[dir] change directory locally
diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt
index eddcb72e3f..cbb2a23a48 100644
--- a/runtime/doc/quickfix.txt
+++ b/runtime/doc/quickfix.txt
@@ -1,4 +1,4 @@
-*quickfix.txt* For Vim version 7.4. Last change: 2016 Jul 01
+*quickfix.txt* For Vim version 7.4. Last change: 2016 Jul 07
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -428,12 +428,17 @@ EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST:
:lw[indow] [height] Same as ":cwindow", except use the window showing the
location list for the current window.
+ *:cbo* *:cbottom*
:cbo[ttom] Put the cursor in the last line of the quickfix window
and scroll to make it visible. This is useful for
when errors are added by an asynchronous callback.
Only call it once in a while if there are many
updates to avoid a lot of redrawing.
+ *:lbo* *:lbottom*
+:lbo[ttom] Same as ":cbottom", except use the window showing the
+ location list for the current window.
+
Normally the quickfix window is at the bottom of the screen. If there are
vertical splits, it's at the bottom of the rightmost column of windows. To
make it always occupy the full width: >
diff --git a/src/nvim/ex_cmds.lua b/src/nvim/ex_cmds.lua
index e39e374e2e..eaf18fc664 100644
--- a/src/nvim/ex_cmds.lua
+++ b/src/nvim/ex_cmds.lua
@@ -1272,6 +1272,12 @@ return {
func='ex_later',
},
{
+ command='lbottom',
+ flags=bit.bor(TRLBAR),
+ addr_type=ADDR_LINES,
+ func='ex_cbottom',
+ },
+ {
command='lbuffer',
flags=bit.bor(BANG, RANGE, NOTADR, WORD1, TRLBAR),
addr_type=ADDR_LINES,
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index c40b7173c5..93d0df1076 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -2449,10 +2449,20 @@ static void qf_win_goto(win_T *win, linenr_T lnum)
curbuf = curwin->w_buffer;
}
-// :cbottom command.
+// :cbottom/:lbottom command.
void ex_cbottom(exarg_T *eap)
{
- win_T *win = qf_find_win(&ql_info);
+ qf_info_T *qi = &ql_info;
+
+ if (eap->cmdidx == CMD_lbottom) {
+ qi = GET_LOC_LIST(curwin);
+ if (qi == NULL) {
+ EMSG(_(e_loclist));
+ return;
+ }
+ }
+
+ win_T *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/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim
index 7b141f17a4..f30902b915 100644
--- a/src/nvim/testdir/test_quickfix.vim
+++ b/src/nvim/testdir/test_quickfix.vim
@@ -15,6 +15,7 @@ function! s:setup_commands(cchar)
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 @@ function! s:setup_commands(cchar)
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 @@ function XwindowTests(cchar)
Xwindow
call assert_true(winnr('$') == 2 && winnr() == 2 &&
\ getline('.') ==# 'Xtestfile1|1 col 3| Line1')
+ redraw!
" Close the window
Xclose
@@ -1397,15 +1400,23 @@ echo string(loc_two)
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/nvim/version.c b/src/nvim/version.c
index 9a273dd66c..512d52cbc4 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -430,7 +430,7 @@ static int included_patches[] = {
2013,
2012,
2011,
- // 2010,
+ 2010,
// 2009,
// 2008,
2007,