Skip to content
Permalink
Browse files

patch 8.1.1275: cannot navigate to errors before/after the cursor

Problem:    Cannot navigate to errors before/after the cursor.
Solution:   Add the :cbefore and :cafter commands. (Yegappan Lakshmanan,
            closes #4340)
  • Loading branch information...
brammool committed May 5, 2019
1 parent ce79353 commit cf6a55c4b0cbf38b0c3fbed5ffd9a3fd0d2ede0e
Showing with 297 additions and 81 deletions.
  1. +6 −2 runtime/doc/index.txt
  2. +30 −2 runtime/doc/quickfix.txt
  3. +26 −26 src/ex_cmdidxs.h
  4. +12 −0 src/ex_cmds.h
  5. +151 −50 src/quickfix.c
  6. +70 −1 src/testdir/test_quickfix.vim
  7. +2 −0 src/version.c
@@ -1192,9 +1192,11 @@ tag command action ~
|:caddbuffer| :cad[dbuffer] add errors from buffer
|:caddexpr| :cadde[xpr] add errors from expr
|:caddfile| :caddf[ile] add error message to current quickfix list
|:cafter| :caf[ter] go to error after current cursor
|:call| :cal[l] call a function
|:catch| :cat[ch] part of a :try command
|:cbelow| :cbe[low] got to error below current line
|:cbefore| :cbef[ore] go to error before current cursor
|:cbelow| :cbel[ow] go 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
@@ -1356,10 +1358,12 @@ tag command action ~
|:laddexpr| :lad[dexpr] add locations from expr
|:laddbuffer| :laddb[uffer] add locations from buffer
|:laddfile| :laddf[ile] add locations to current location list
|:lafter| :laf[ter] go to location after current cursor
|: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
|:lbefore| :lbef[ore] go to location before current cursor
|:lbelow| :lbel[ow] 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
@@ -152,8 +152,36 @@ processing a quickfix or location list command, it will be aborted.
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
*:lbel* *:lbelow*
:[count]lbel[ow] Same as ":cbelow", except the location list for the
current window is used instead of the quickfix list.

*:cbe* *:cbefore*
:[count]cbe[fore] Go to the [count] error before the current cursor
position 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,
line and column numbers. If [count] exceeds the
number of entries before the current position, then
the first error in the file is selected.

*:lbef* *:lbefore*
:[count]lbef[ore] Same as ":cbefore", except the location list for the
current window is used instead of the quickfix list.

*:caf* *:cafter*
:[count]caf[ter] Go to the [count] error after the current cursor
position 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,
line and column numbers. If [count] exceeds the
number of entries after the current position, then
the last error in the file is selected.

*:laf* *:lafter*
:[count]laf[ter] Same as ":cafter", except the location list for the
current window is used instead of the quickfix list.

*:cnf* *:cnfile*
@@ -8,29 +8,29 @@ static const unsigned short cmdidxs1[26] =
/* a */ 0,
/* b */ 19,
/* c */ 42,
/* 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
/* d */ 107,
/* e */ 129,
/* f */ 149,
/* g */ 165,
/* h */ 171,
/* i */ 180,
/* j */ 198,
/* k */ 200,
/* l */ 205,
/* m */ 267,
/* n */ 285,
/* o */ 305,
/* p */ 317,
/* q */ 356,
/* r */ 359,
/* s */ 379,
/* t */ 447,
/* u */ 492,
/* v */ 503,
/* w */ 521,
/* x */ 535,
/* y */ 544,
/* z */ 545
};

/*
@@ -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, 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 },
/* c */ { 3, 12, 16, 18, 20, 22, 25, 0, 0, 0, 0, 33, 37, 40, 46, 55, 57, 58, 59, 0, 61, 0, 64, 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, 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 },
/* l */ { 3, 11, 15, 19, 20, 24, 27, 32, 0, 0, 0, 34, 37, 40, 44, 50, 0, 52, 61, 53, 54, 58, 60, 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 = 554;
static const int command_count = 558;
@@ -266,6 +266,9 @@ EX(CMD_caddexpr, "caddexpr", ex_cexpr,
EX(CMD_caddfile, "caddfile", ex_cfile,
TRLBAR|FILE1,
ADDR_NONE),
EX(CMD_cafter, "cafter", ex_cbelow,
RANGE|COUNT|TRLBAR,
ADDR_UNSIGNED),
EX(CMD_call, "call", ex_call,
RANGE|NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN,
ADDR_LINES),
@@ -275,6 +278,9 @@ EX(CMD_catch, "catch", ex_catch,
EX(CMD_cbuffer, "cbuffer", ex_cbuffer,
BANG|RANGE|WORD1|TRLBAR,
ADDR_OTHER),
EX(CMD_cbefore, "cbefore", ex_cbelow,
RANGE|COUNT|TRLBAR,
ADDR_UNSIGNED),
EX(CMD_cbelow, "cbelow", ex_cbelow,
RANGE|COUNT|TRLBAR,
ADDR_UNSIGNED),
@@ -749,12 +755,18 @@ EX(CMD_laddbuffer, "laddbuffer", ex_cbuffer,
EX(CMD_laddfile, "laddfile", ex_cfile,
TRLBAR|FILE1,
ADDR_NONE),
EX(CMD_lafter, "lafter", ex_cbelow,
RANGE|COUNT|TRLBAR,
ADDR_UNSIGNED),
EX(CMD_later, "later", ex_later,
TRLBAR|EXTRA|NOSPC|CMDWIN,
ADDR_NONE),
EX(CMD_lbuffer, "lbuffer", ex_cbuffer,
BANG|RANGE|WORD1|TRLBAR,
ADDR_OTHER),
EX(CMD_lbefore, "lbefore", ex_cbelow,
RANGE|COUNT|TRLBAR,
ADDR_UNSIGNED),
EX(CMD_lbelow, "lbelow", ex_cbelow,
RANGE|COUNT|TRLBAR,
ADDR_UNSIGNED),

0 comments on commit cf6a55c

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