mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-05-19 01:30:21 -07:00
parent
2e2af50a4d
commit
a77b914e7a
@ -49,6 +49,8 @@ Bug fixes:
|
|||||||
Clarify how the `--hidden` flag works.
|
Clarify how the `--hidden` flag works.
|
||||||
* [BUG #1866](https://github.com/BurntSushi/ripgrep/issues/1866#issuecomment-841635553):
|
* [BUG #1866](https://github.com/BurntSushi/ripgrep/issues/1866#issuecomment-841635553):
|
||||||
Fix bug when computing column numbers in `--vimgrep` mode.
|
Fix bug when computing column numbers in `--vimgrep` mode.
|
||||||
|
* [BUG #1868](https://github.com/BurntSushi/ripgrep/issues/1868):
|
||||||
|
Fix bug where `--passthru` and `-A/-B/-C` did not override each other.
|
||||||
* [BUG #1878](https://github.com/BurntSushi/ripgrep/issues/1878):
|
* [BUG #1878](https://github.com/BurntSushi/ripgrep/issues/1878):
|
||||||
Fix bug where `\A` could produce unanchored matches in multiline search.
|
Fix bug where `\A` could produce unanchored matches in multiline search.
|
||||||
* [BUG 94e4b8e3](https://github.com/BurntSushi/ripgrep/commit/94e4b8e3):
|
* [BUG 94e4b8e3](https://github.com/BurntSushi/ripgrep/commit/94e4b8e3):
|
||||||
|
@ -696,7 +696,7 @@ fn flag_after_context(args: &mut Vec<RGArg>) {
|
|||||||
"\
|
"\
|
||||||
Show NUM lines after each match.
|
Show NUM lines after each match.
|
||||||
|
|
||||||
This overrides the --context flag.
|
This overrides the --context and --passthru flags.
|
||||||
"
|
"
|
||||||
);
|
);
|
||||||
let arg = RGArg::flag("after-context", "NUM")
|
let arg = RGArg::flag("after-context", "NUM")
|
||||||
@ -704,6 +704,7 @@ This overrides the --context flag.
|
|||||||
.help(SHORT)
|
.help(SHORT)
|
||||||
.long_help(LONG)
|
.long_help(LONG)
|
||||||
.number()
|
.number()
|
||||||
|
.overrides("passthru")
|
||||||
.overrides("context");
|
.overrides("context");
|
||||||
args.push(arg);
|
args.push(arg);
|
||||||
}
|
}
|
||||||
@ -765,7 +766,7 @@ fn flag_before_context(args: &mut Vec<RGArg>) {
|
|||||||
"\
|
"\
|
||||||
Show NUM lines before each match.
|
Show NUM lines before each match.
|
||||||
|
|
||||||
This overrides the --context flag.
|
This overrides the --context and --passthru flags.
|
||||||
"
|
"
|
||||||
);
|
);
|
||||||
let arg = RGArg::flag("before-context", "NUM")
|
let arg = RGArg::flag("before-context", "NUM")
|
||||||
@ -773,6 +774,7 @@ This overrides the --context flag.
|
|||||||
.help(SHORT)
|
.help(SHORT)
|
||||||
.long_help(LONG)
|
.long_help(LONG)
|
||||||
.number()
|
.number()
|
||||||
|
.overrides("passthru")
|
||||||
.overrides("context");
|
.overrides("context");
|
||||||
args.push(arg);
|
args.push(arg);
|
||||||
}
|
}
|
||||||
@ -1005,7 +1007,8 @@ fn flag_context(args: &mut Vec<RGArg>) {
|
|||||||
Show NUM lines before and after each match. This is equivalent to providing
|
Show NUM lines before and after each match. This is equivalent to providing
|
||||||
both the -B/--before-context and -A/--after-context flags with the same value.
|
both the -B/--before-context and -A/--after-context flags with the same value.
|
||||||
|
|
||||||
This overrides both the -B/--before-context and -A/--after-context flags.
|
This overrides both the -B/--before-context and -A/--after-context flags,
|
||||||
|
in addition to the --passthru flag.
|
||||||
"
|
"
|
||||||
);
|
);
|
||||||
let arg = RGArg::flag("context", "NUM")
|
let arg = RGArg::flag("context", "NUM")
|
||||||
@ -1013,6 +1016,7 @@ This overrides both the -B/--before-context and -A/--after-context flags.
|
|||||||
.help(SHORT)
|
.help(SHORT)
|
||||||
.long_help(LONG)
|
.long_help(LONG)
|
||||||
.number()
|
.number()
|
||||||
|
.overrides("passthru")
|
||||||
.overrides("before-context")
|
.overrides("before-context")
|
||||||
.overrides("after-context");
|
.overrides("after-context");
|
||||||
args.push(arg);
|
args.push(arg);
|
||||||
@ -2348,12 +2352,17 @@ the empty string. For example, if you are searching using 'rg foo' then using
|
|||||||
'rg \"^|foo\"' instead will emit every line in every file searched, but only
|
'rg \"^|foo\"' instead will emit every line in every file searched, but only
|
||||||
occurrences of 'foo' will be highlighted. This flag enables the same behavior
|
occurrences of 'foo' will be highlighted. This flag enables the same behavior
|
||||||
without needing to modify the pattern.
|
without needing to modify the pattern.
|
||||||
|
|
||||||
|
This overrides the --context, --after-context and --before context flags.
|
||||||
"
|
"
|
||||||
);
|
);
|
||||||
let arg = RGArg::switch("passthru")
|
let arg = RGArg::switch("passthru")
|
||||||
.help(SHORT)
|
.help(SHORT)
|
||||||
.long_help(LONG)
|
.long_help(LONG)
|
||||||
.alias("passthrough");
|
.alias("passthrough")
|
||||||
|
.overrides("after-context")
|
||||||
|
.overrides("before-context")
|
||||||
|
.overrides("context");
|
||||||
args.push(arg);
|
args.push(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -883,6 +883,31 @@ test:3:5:foo quux
|
|||||||
eqnice!(expected, cmd.stdout());
|
eqnice!(expected, cmd.stdout());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// See: https://github.com/BurntSushi/ripgrep/issues/1868
|
||||||
|
rgtest!(r1868_context_passthru_override, |dir: Dir, _: TestCommand| {
|
||||||
|
dir.create("test", "foo\nbar\nbaz\nquux\n");
|
||||||
|
|
||||||
|
let args = &["-C1", "bar", "test"];
|
||||||
|
eqnice!("foo\nbar\nbaz\n", dir.command().args(args).stdout());
|
||||||
|
let args = &["--passthru", "bar", "test"];
|
||||||
|
eqnice!("foo\nbar\nbaz\nquux\n", dir.command().args(args).stdout());
|
||||||
|
|
||||||
|
let args = &["--passthru", "-C1", "bar", "test"];
|
||||||
|
eqnice!("foo\nbar\nbaz\n", dir.command().args(args).stdout());
|
||||||
|
let args = &["-C1", "--passthru", "bar", "test"];
|
||||||
|
eqnice!("foo\nbar\nbaz\nquux\n", dir.command().args(args).stdout());
|
||||||
|
|
||||||
|
let args = &["--passthru", "-B1", "bar", "test"];
|
||||||
|
eqnice!("foo\nbar\n", dir.command().args(args).stdout());
|
||||||
|
let args = &["-B1", "--passthru", "bar", "test"];
|
||||||
|
eqnice!("foo\nbar\nbaz\nquux\n", dir.command().args(args).stdout());
|
||||||
|
|
||||||
|
let args = &["--passthru", "-A1", "bar", "test"];
|
||||||
|
eqnice!("bar\nbaz\n", dir.command().args(args).stdout());
|
||||||
|
let args = &["-A1", "--passthru", "bar", "test"];
|
||||||
|
eqnice!("foo\nbar\nbaz\nquux\n", dir.command().args(args).stdout());
|
||||||
|
});
|
||||||
|
|
||||||
rgtest!(r1878, |dir: Dir, _: TestCommand| {
|
rgtest!(r1878, |dir: Dir, _: TestCommand| {
|
||||||
dir.create("test", "a\nbaz\nabc\n");
|
dir.create("test", "a\nbaz\nabc\n");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user