Indexes incorrect after refining search results
dwu opened this issue · 2 comments
dwu commented
When a previous search is refined, the new indexes are computed incorrectly.
Here's an example for reproducing the error on vgrep's extracted source for version 2.5.6.
Initial search:
$ ./vgrep --no-less lines
Index File Line Content
0 vgrep.go 368 // context lines.
1 vgrep.go 722 fmt.Printf("%q doesn't match format %q\n", input, "comma
<... output snipped ...>
160 README.md 60 - ``refine`` to keep only lines matching the provided regexp pattern from the results, for the duration of the interactive shell (requires a regexp string).
161 README.md 68 ## Context lines
Refining the search:
$ ./vgrep --no-less --interactive
Enter a vgrep command: r Returns
Enter a vgrep command: p
Index File Line Content
18 vendor/github.com/peterh/liner/common.go 79 // ReadHistory reads scrollback history from r. Returns the number of lines
18 vendor/github.com/peterh/liner/common.go 110 // WriteHistory writes scrollback history to w. Returns the number of lines
19 vendor/github.com/peterh/liner/common.go 155 // Returns the history lines starting with prefix
19 vendor/github.com/peterh/liner/common.go 165 // Returns the history lines matching the intelligent search
Enter a vgrep command: p 18
index 18 out of range (0, 3)
dwu commented
Works great. Thanks for the quick fix.