summaryrefslogtreecommitdiff
path: root/Documentation/i18n.txt
diff options
context:
space:
mode:
authorLibravatar Taylor Blau <me@ttaylorr.com>2018-06-22 10:49:35 -0500
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-06-22 12:59:02 -0700
commit68d686e6af0fc192fce1788f67bbe0c21a5419ab (patch)
tree65fb8399de80ad79e25e51bfb808606ea9551991 /Documentation/i18n.txt
parentDocumentation/config.txt: camel-case lineNumber for consistency (diff)
downloadtgif-68d686e6af0fc192fce1788f67bbe0c21a5419ab.tar.xz
grep.c: expose {,inverted} match column in match_line()
When calling match_line(), callers presently cannot determine the relative offset of the match because match_line() discards the 'regmatch_t' that contains this information. Instead, teach match_line() to take in two 'ssize_t's. Fill the first with the offset of the match produced by the given expression. If extended, fill the later with the offset of the match produced as if --invert were given. For instance, matching "--not -e x" on this line produces a columnar offset of 0, (i.e., the whole line does not contain an x), but "--invert --not -e -x" will fill the later ssize_t of the column containing an "x", because this expression is semantically equivalent to "-e x". To determine the column for the inverted and non-inverted case, do the following: - If matching an atom, the non-inverted column is as given from match_one_pattern(), and the inverted column is unset. - If matching a --not, the inverted column and non-inverted column swap. - If matching an --and, or --or, the non-inverted column is the minimum of the two children. Presently, the existing short-circuiting logic for AND and OR applies as before. This will change in the following commit when we add options to configure the --column flag. Taken together, this and the forthcoming change will always yield the earlier column on a given line. This patch will become useful when we later pick between the two new results in order to display the column number of the first match on a line with --column. Co-authored-by: Jeff King <peff@peff.net> Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/i18n.txt')
0 files changed, 0 insertions, 0 deletions