diff options
author | Fabian Homborg <FHomborg@gmail.com> | 2016-05-31 23:14:03 +0200 |
---|---|---|
committer | Fabian Homborg <FHomborg@gmail.com> | 2016-05-31 23:24:08 +0200 |
commit | 8d6735cb4194094b6f3e41573bbfffeb3d49d6ea (patch) | |
tree | 3b06c79b003a377bf9c087e5dd10415cee750f1d /src | |
parent | 3d74b160b3f1a7c424f38b815320b14bc712eb69 (diff) |
Make string match -rnv work
Fixes #3098.
Diffstat (limited to 'src')
-rw-r--r-- | src/builtin_string.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/builtin_string.cpp b/src/builtin_string.cpp index edb6320f..a2ac0244 100644 --- a/src/builtin_string.cpp +++ b/src/builtin_string.cpp @@ -376,8 +376,12 @@ class pcre2_matcher_t : public string_matcher_t { // Return values: -1 = error, 0 = no match, 1 = match. if (pcre2_rc == PCRE2_ERROR_NOMATCH) { if (opts.invert_match && !opts.quiet) { - streams.out.append(arg); - streams.out.push_back(L'\n'); + if (opts.index) { + streams.out.append_format(L"1 %lu\n", wcslen(arg)); + } else { + streams.out.append(arg); + streams.out.push_back(L'\n'); + } } return opts.invert_match ? 1 : 0; |