git-grep: add comments on highlighting support
This commit is contained in:
parent
9c70c7a8ea
commit
cd62d0f5e8
1 changed files with 4 additions and 0 deletions
|
@ -85,6 +85,9 @@ func GrepSearch(ctx context.Context, repo *Repository, search string, opts GrepO
|
|||
"-I", "--null", "--break", "--heading",
|
||||
"--line-number", "--ignore-case", "--full-name")
|
||||
if opts.Mode == RegExpGrepMode {
|
||||
// No `--column` -- regexp mode does not support highlighting in the
|
||||
// current implementation as the length of the match is unknown from
|
||||
// `grep` but required for highlighting.
|
||||
cmd.AddArguments("--perl-regexp")
|
||||
} else {
|
||||
cmd.AddArguments("--fixed-strings", "--column")
|
||||
|
@ -161,6 +164,7 @@ func GrepSearch(ctx context.Context, repo *Repository, search string, opts GrepO
|
|||
if lineNum, lineCode, ok := strings.Cut(line, "\x00"); ok {
|
||||
lineNumInt, _ := strconv.Atoi(lineNum)
|
||||
res.LineNumbers = append(res.LineNumbers, lineNumInt)
|
||||
// We support highlighting only when `--column` parameter is used.
|
||||
if lineCol, lineCode2, ok := strings.Cut(lineCode, "\x00"); ok {
|
||||
lineColInt, _ := strconv.Atoi(lineCol)
|
||||
start := lineColInt - 1
|
||||
|
|
Loading…
Add table
Reference in a new issue