Skip to content
Permalink
Browse files

patch 8.1.1256: cannot navigate through errors relative to the cursor

Problem:    Cannot navigate through errors relative to the cursor.
Solution:   Add :cabove, :cbelow, :labove and :lbelow. (Yegappan Lakshmanan,
            closes #4316)
  • Loading branch information...
brammool committed May 3, 2019
1 parent 12e9186 commit 3ff33114d70fc0f7e9c3187c5fec9028f6499cf3
Showing with 494 additions and 29 deletions.
  1. +4 −0 runtime/doc/index.txt
  2. +30 −0 runtime/doc/quickfix.txt
  3. +26 −26 src/ex_cmdidxs.h
  4. +12 −0 src/ex_cmds.h
  5. +1 −0 src/ex_docmd.c
  6. +1 −0 src/proto/quickfix.pro
  7. +308 −3 src/quickfix.c
  8. +110 −0 src/testdir/test_quickfix.vim
  9. +2 −0 src/version.c
@@ -1188,11 +1188,13 @@ tag command action ~
|: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
|:cabove| :cabo[ve] go to error above current line
|: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
|:cbelow| :cbe[low] got to error below current line
|: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
@@ -1350,12 +1352,14 @@ tag command action ~
|:lNext| :lN[ext] go to previous entry in location list
|:lNfile| :lNf[ile] go to last entry in previous file
|:list| :l[ist] print lines
|:labove| :lab[ove] go to location above current line
|:laddexpr| :lad[dexpr] add locations from expr
|:laddbuffer| :laddb[uffer] add locations from buffer
|:laddfile| :laddf[ile] add locations to current location list
|: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
|:lbelow| :lbe[low] go to location below current line
|: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
@@ -123,6 +123,36 @@ processing a quickfix or location list command, it will be aborted.
list for the current window is used instead of the
quickfix list.

*:cabo* *:cabove*
:[count]cabo[ve] Go to the [count] error above the current line in the
current buffer. If [count] is omitted, then 1 is
used. If there are no errors, then an error message
is displayed. Assumes that the entries in a quickfix
list are sorted by their buffer number and line
number. If there are multiple errors on the same line,
then only the first entry is used. If [count] exceeds
the number of entries above the current line, then the
first error in the file is selected.

*:lab* *:labove*
:[count]lab[ove] Same as ":cabove", except the location list for the
current window is used instead of the quickfix list.

*:cbe* *:cbelow*
:[count]cbe[low] Go to the [count] error below the current line in the
current buffer. If [count] is omitted, then 1 is
used. If there are no errors, then an error message
is displayed. Assumes that the entries in a quickfix
list are sorted by their buffer number and line
number. If there are multiple errors on the same
line, then only the first entry is used. If [count]
exceeds the number of entries below the current line,
then the last error in the file is selected.

*:lbe* *:lbelow*
:[count]lbe[low] Same as ":cbelow", except the location list for the
current window is used instead of the quickfix list.

*:cnf* *:cnfile*
:[count]cnf[ile][!] Display the first error in the [count] next file in
the list that includes a file name. If there are no
@@ -8,29 +8,29 @@ static const unsigned short cmdidxs1[26] =
/* a */ 0,
/* b */ 19,
/* c */ 42,
/* d */ 103,
/* e */ 125,
/* f */ 145,
/* g */ 161,
/* h */ 167,
/* i */ 176,
/* j */ 194,
/* k */ 196,
/* l */ 201,
/* m */ 259,
/* n */ 277,
/* o */ 297,
/* p */ 309,
/* q */ 348,
/* r */ 351,
/* s */ 371,
/* t */ 439,
/* u */ 484,
/* v */ 495,
/* w */ 513,
/* x */ 527,
/* y */ 536,
/* z */ 537
/* d */ 105,
/* e */ 127,
/* f */ 147,
/* g */ 163,
/* h */ 169,
/* i */ 178,
/* j */ 196,
/* k */ 198,
/* l */ 203,
/* m */ 263,
/* n */ 281,
/* o */ 301,
/* p */ 313,
/* q */ 352,
/* r */ 355,
/* s */ 375,
/* t */ 443,
/* u */ 488,
/* v */ 499,
/* w */ 517,
/* x */ 531,
/* y */ 540,
/* z */ 541
};

/*
@@ -43,7 +43,7 @@ static const unsigned char cmdidxs2[26][26] =
{ /* a b c d e f g h i j k l m n o p q r s t u v w x y z */
/* a */ { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 6, 0, 0, 0, 7, 15, 0, 16, 0, 0, 0, 0, 0 },
/* b */ { 2, 0, 0, 4, 5, 7, 0, 0, 0, 0, 0, 8, 9, 10, 11, 12, 0, 13, 0, 0, 0, 0, 22, 0, 0, 0 },
/* c */ { 3, 10, 12, 14, 16, 18, 21, 0, 0, 0, 0, 29, 33, 36, 42, 51, 53, 54, 55, 0, 57, 0, 60, 0, 0, 0 },
/* c */ { 3, 11, 14, 16, 18, 20, 23, 0, 0, 0, 0, 31, 35, 38, 44, 53, 55, 56, 57, 0, 59, 0, 62, 0, 0, 0 },
/* d */ { 0, 0, 0, 0, 0, 0, 0, 0, 6, 15, 0, 16, 0, 0, 17, 0, 0, 19, 20, 0, 0, 0, 0, 0, 0, 0 },
/* e */ { 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0 },
/* f */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0 },
@@ -52,7 +52,7 @@ static const unsigned char cmdidxs2[26][26] =
/* i */ { 1, 0, 0, 0, 0, 3, 0, 0, 0, 4, 0, 5, 6, 0, 0, 0, 0, 0, 13, 0, 15, 0, 0, 0, 0, 0 },
/* j */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 },
/* k */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
/* l */ { 3, 9, 11, 15, 16, 20, 23, 28, 0, 0, 0, 30, 33, 36, 40, 46, 0, 48, 57, 49, 50, 54, 56, 0, 0, 0 },
/* l */ { 3, 10, 13, 17, 18, 22, 25, 30, 0, 0, 0, 32, 35, 38, 42, 48, 0, 50, 59, 51, 52, 56, 58, 0, 0, 0 },
/* m */ { 1, 0, 0, 0, 7, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16 },
/* n */ { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 10, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0 },
/* o */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 5, 0, 0, 0, 0, 0, 0, 9, 0, 11, 0, 0, 0 },
@@ -69,4 +69,4 @@ static const unsigned char cmdidxs2[26][26] =
/* z */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};

static const int command_count = 550;
static const int command_count = 554;
@@ -252,6 +252,9 @@ EX(CMD_cabbrev, "cabbrev", ex_abbreviate,
EX(CMD_cabclear, "cabclear", ex_abclear,
EXTRA|TRLBAR|CMDWIN,
ADDR_NONE),
EX(CMD_cabove, "cabove", ex_cbelow,
RANGE|TRLBAR,
ADDR_OTHER),
EX(CMD_caddbuffer, "caddbuffer", ex_cbuffer,
RANGE|WORD1|TRLBAR,
ADDR_OTHER),
@@ -270,6 +273,9 @@ EX(CMD_catch, "catch", ex_catch,
EX(CMD_cbuffer, "cbuffer", ex_cbuffer,
BANG|RANGE|WORD1|TRLBAR,
ADDR_OTHER),
EX(CMD_cbelow, "cbelow", ex_cbelow,
RANGE|TRLBAR,
ADDR_OTHER),
EX(CMD_cbottom, "cbottom", ex_cbottom,
TRLBAR,
ADDR_NONE),
@@ -726,6 +732,9 @@ EX(CMD_lNfile, "lNfile", ex_cnext,
EX(CMD_last, "last", ex_last,
EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR,
ADDR_NONE),
EX(CMD_labove, "labove", ex_cbelow,
RANGE|TRLBAR,
ADDR_OTHER),
EX(CMD_language, "language", ex_language,
EXTRA|TRLBAR|CMDWIN,
ADDR_NONE),
@@ -744,6 +753,9 @@ EX(CMD_later, "later", ex_later,
EX(CMD_lbuffer, "lbuffer", ex_cbuffer,
BANG|RANGE|WORD1|TRLBAR,
ADDR_OTHER),
EX(CMD_lbelow, "lbelow", ex_cbelow,
RANGE|TRLBAR,
ADDR_OTHER),
EX(CMD_lbottom, "lbottom", ex_cbottom,
TRLBAR,
ADDR_NONE),
@@ -56,6 +56,7 @@ static int getargopt(exarg_T *eap);
# define ex_cbuffer ex_ni
# define ex_cc ex_ni
# define ex_cnext ex_ni
# define ex_cbelow ex_ni
# define ex_cfile ex_ni
# define qf_list ex_ni
# define qf_age ex_ni
@@ -23,6 +23,7 @@ int qf_get_cur_idx(exarg_T *eap);
int qf_get_cur_valid_idx(exarg_T *eap);
void ex_cc(exarg_T *eap);
void ex_cnext(exarg_T *eap);
void ex_cbelow(exarg_T *eap);
void ex_cfile(exarg_T *eap);
void ex_vimgrep(exarg_T *eap);
int get_errorlist(qf_info_T *qi_arg, win_T *wp, int qf_idx, list_T *list);

0 comments on commit 3ff3311

Please sign in to comment.
You can’t perform that action at this time.