To: vim_dev@googlegroups.com Subject: Patch 7.4.2010 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.2010 Problem: There is a :cbottom command but no :lbottom command. Solution: Add :lbottom. (Yegappan Lakshmanan) Files: runtime/doc/index.txt, runtime/doc/quickfix.txt, src/ex_cmds.h, src/quickfix.c, src/testdir/test_quickfix.vim *** ../vim-7.4.2009/runtime/doc/index.txt 2015-09-08 18:46:04.341233631 +0200 --- runtime/doc/index.txt 2016-07-09 17:48:49.160872770 +0200 *************** *** 1124,1134 **** |:cNfile| :cNf[ile] go to last error in previous file |:cabbrev| :ca[bbrev] like ":abbreviate" but for Command-line mode |:cabclear| :cabc[lear] clear all abbreviations for Command-line mode ! |:caddbuffer| :caddb[uffer] add errors from buffer ! |:caddexpr| :cad[dexpr] add errors from expr |:caddfile| :caddf[ile] add error message to current quickfix list |:call| :cal[l] call a function |:catch| :cat[ch] part of a :try command |:cbuffer| :cb[uffer] parse error messages and jump to first error |:cc| :cc go to specific error |:cclose| :ccl[ose] close quickfix window --- 1134,1145 ---- |:cNfile| :cNf[ile] go to last error in previous file |:cabbrev| :ca[bbrev] like ":abbreviate" but for Command-line mode |:cabclear| :cabc[lear] clear all abbreviations for Command-line mode ! |:caddbuffer| :cad[dbuffer] add errors from buffer ! |:caddexpr| :cadde[xpr] add errors from expr |: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 *************** *** 1287,1297 **** |: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 |:lbuffer| :lb[uffer] parse locations and jump to first location |:lcd| :lc[d] change directory locally |:lchdir| :lch[dir] change directory locally |:lclose| :lcl[ose] close location window ! |:lcscope| :lcs[cope] like ":cscope" but uses location list |:ldo| :ld[o] execute command in valid location list entries |:lfdo| :lfd[o] execute command in each file in location list |:left| :le[ft] left align lines --- 1300,1311 ---- |: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 |:lclose| :lcl[ose] close location window ! |:lcscope| :lcs[cope] like ":cscope" but uses location list |:ldo| :ld[o] execute command in valid location list entries |:lfdo| :lfd[o] execute command in each file in location list |:left| :le[ft] left align lines *** ../vim-7.4.2009/runtime/doc/quickfix.txt 2016-07-07 18:58:55.368713570 +0200 --- runtime/doc/quickfix.txt 2016-07-09 17:48:49.160872770 +0200 *************** *** 427,438 **** --- 437,453 ---- :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: > *** ../vim-7.4.2009/src/ex_cmds.h 2016-07-07 18:58:55.364713631 +0200 --- src/ex_cmds.h 2016-07-09 17:48:49.160872770 +0200 *************** *** 724,729 **** --- 724,732 ---- 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), *** ../vim-7.4.2009/src/quickfix.c 2016-07-07 18:58:55.364713631 +0200 --- src/quickfix.c 2016-07-09 17:48:49.164872710 +0200 *************** *** 2831,2843 **** } /* ! * :cbottom command. */ void ex_cbottom(exarg_T *eap UNUSED) { ! win_T *win = qf_find_win(&ql_info); 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); } --- 2831,2855 ---- } /* ! * :cbottom/:lbottom commands. */ void ex_cbottom(exarg_T *eap UNUSED) { ! 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); } *** ../vim-7.4.2009/src/testdir/test_quickfix.vim 2016-07-07 18:58:55.368713570 +0200 --- src/testdir/test_quickfix.vim 2016-07-09 17:48:49.164872710 +0200 *************** *** 15,20 **** --- 15,21 ---- command! -nargs=* Xnewer cnewer command! -nargs=* Xopen copen command! -nargs=* Xwindow cwindow + command! -nargs=* Xbottom cbottom command! -nargs=* Xclose cclose command! -nargs=* -bang Xfile cfile command! -nargs=* Xgetfile cgetfile *************** *** 44,49 **** --- 45,51 ---- command! -nargs=* Xnewer lnewer command! -nargs=* Xopen lopen command! -nargs=* Xwindow lwindow + command! -nargs=* Xbottom lbottom command! -nargs=* Xclose lclose command! -nargs=* -bang Xfile lfile command! -nargs=* Xgetfile lgetfile *************** *** 200,205 **** --- 202,208 ---- Xwindow call assert_true(winnr('$') == 2 && winnr() == 2 && \ getline('.') ==# 'Xtestfile1|1 col 3| Line1') + redraw! " Close the window Xclose *************** *** 1415,1429 **** call delete('Xtwo', 'rf') endfunc ! function Test_cbottom() ! call setqflist([{'filename': 'foo', 'lnum': 42}]) ! copen let wid = win_getid() call assert_equal(1, line('.')) wincmd w ! call setqflist([{'filename': 'var', 'lnum': 24}], 'a') ! cbottom call win_gotoid(wid) call assert_equal(2, line('.')) ! cclose endfunc --- 1418,1440 ---- call delete('Xtwo', 'rf') endfunc ! 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 g:Xsetlist([{'filename': 'var', 'lnum': 24}], 'a') ! Xbottom call win_gotoid(wid) call assert_equal(2, line('.')) ! Xclose endfunc + + " Tests for the :cbottom and :lbottom commands + function Test_cbottom() + call XbottomTests('c') + call XbottomTests('l') + endfunction *** ../vim-7.4.2009/src/version.c 2016-07-09 17:39:23.869279327 +0200 --- src/version.c 2016-07-09 17:49:53.107922161 +0200 *************** *** 760,761 **** --- 760,763 ---- { /* Add new patch number below this line */ + /**/ + 2010, /**/ -- hundred-and-one symptoms of being an internet addict: 244. You use more than 20 passwords. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///