mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-04-24 17:12:16 +02:00
core: fix file separator bug
I introduced a regression in the migration off of the clap by having both the buffer writer and the printer be responsible for printing file separators in multi-threaded search. The buffer writer owns that responsibility in multi-threaded search.
This commit is contained in:
parent
082245dadb
commit
c81caa673b
@ -592,7 +592,8 @@ impl HiArgs {
|
|||||||
&self,
|
&self,
|
||||||
wtr: W,
|
wtr: W,
|
||||||
) -> grep::printer::Standard<W> {
|
) -> grep::printer::Standard<W> {
|
||||||
grep::printer::StandardBuilder::new()
|
let mut builder = grep::printer::StandardBuilder::new();
|
||||||
|
builder
|
||||||
.byte_offset(self.byte_offset)
|
.byte_offset(self.byte_offset)
|
||||||
.color_specs(self.colors.clone())
|
.color_specs(self.colors.clone())
|
||||||
.column(self.column)
|
.column(self.column)
|
||||||
@ -615,10 +616,17 @@ impl HiArgs {
|
|||||||
self.field_match_separator.clone().into_bytes(),
|
self.field_match_separator.clone().into_bytes(),
|
||||||
)
|
)
|
||||||
.separator_path(self.path_separator.clone())
|
.separator_path(self.path_separator.clone())
|
||||||
.separator_search(self.file_separator.clone())
|
|
||||||
.stats(self.stats.is_some())
|
.stats(self.stats.is_some())
|
||||||
.trim_ascii(self.trim)
|
.trim_ascii(self.trim);
|
||||||
.build(wtr)
|
// When doing multi-threaded searching, the buffer writer is
|
||||||
|
// responsible for writing separators since it is the only thing that
|
||||||
|
// knows whether something has been printed or not. But for the single
|
||||||
|
// threaded case, we don't use a buffer writer and thus can let the
|
||||||
|
// printer own this.
|
||||||
|
if self.threads == 1 {
|
||||||
|
builder.separator_search(self.file_separator.clone());
|
||||||
|
}
|
||||||
|
builder.build(wtr)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Builds a "summary" printer where search results are aggregated on a
|
/// Builds a "summary" printer where search results are aggregated on a
|
||||||
|
Loading…
x
Reference in New Issue
Block a user