Skip to content

Commit

Permalink
Update examples to not-experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
walles committed Oct 21, 2024
1 parent dbda95b commit 2f94a8c
Show file tree
Hide file tree
Showing 21 changed files with 113 additions and 113 deletions.
4 changes: 2 additions & 2 deletions testdata/add-trailing-newline.riff-output
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[1m--- [7m[22m[31mbefore[27m[1m[39m.txt[22m[2m 2023-09-24 15:58:26[0m
[1m+++ [7m[22m[32mafter[27m[1m[39m.txt[22m[2m 2023-09-24 15:58:02[0m
[36m@@ -1,1 +1,1 @@[0m
[31m-[33mapor[0m
[31m-apor[0m
[2m\ No newline at end of file[0m
[32m+[33mapor[7m[32m⏎[0m
[32m+apor[7m⏎[0m
4 changes: 2 additions & 2 deletions testdata/adds-only.riff-output
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[1m--- [0m/tmp/[7m[31ma[27m[1m[39m.txt[22m[2m 2023-08-06 16:07:37.000000000 +0200[0m
[1m+++ [0m/tmp/[7m[32mb[27m[1m[39m.txt[22m[2m 2023-08-06 16:07:39.000000000 +0200[0m
[36m@@ -1,2 +1,2 @@[0m
[31m-[33mHello, my name is Johan[0m
[32m+[33mHello, my [7m[32mfirst [27m[33mname is Johan[0m
[31m-Hello, my name is Johan[0m
[32m+Hello, my [7mfirst [27mname is Johan[0m
I like pie.
16 changes: 8 additions & 8 deletions testdata/consecutive-words.riff-output
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ Date: Thu Dec 31 15:22:09 2020 +0100
/// it.
const MAX_HIGHLIGHT_PERCENTAGE: usize = 30;

[31m-[33mconst [7m[31mLARGE_BYTE_COUNT_CHANGE_PERCENT[27m[33m: usize = 100;[0m
[31m-[33mconst [7m[31mSMALL_BYTE_COUNT_CHANGE[27m[33m: usize = 10;[0m
[32m+[33mconst [7m[32mLARGE_COUNT_CHANGE_PERCENT[27m[33m: usize = 100;[0m
[32m+[33mconst [7m[32mSMALL_COUNT_CHANGE[27m[33m: usize = 10;[0m
[31m-const [7mLARGE_BYTE_COUNT_CHANGE_PERCENT[27m: usize = 100;[0m
[31m-const [7mSMALL_BYTE_COUNT_CHANGE[27m: usize = 10;[0m
[32m+const [7mLARGE_COUNT_CHANGE_PERCENT[27m: usize = 100;[0m
[32m+const [7mSMALL_COUNT_CHANGE[27m: usize = 10;[0m

/// Format old and new lines in OLD and NEW colors.
///
[36m@@ -55,11 +55,14 @@ [1mpub fn format(old_text: &str, new_text: &str) -> Vec<String> {[0m
return simple_format(old_text, new_text);
}

[31m-[33m // [7m[31mThis check makes[27m[33m us faster, please use the benchmark.py script before and[0m
[31m- //[33m after if you change this.[0m
[32m+[33m // [7m[32mThese checks make[27m[33m us faster, please use the benchmark.py script before[0m
[32m+ //[33m and after if you change this.[0m
[31m- // [7mThis check makes[27m us faster, please use the benchmark.py script before and[0m
[31m- // after if you change this.[0m
[32m+ // [7mThese checks make[27m us faster, please use the benchmark.py script before[0m
[32m+ // and after if you change this.[0m
if is_large_byte_count_change(old_text, new_text) {
return simple_format(old_text, new_text);
}
Expand Down
8 changes: 4 additions & 4 deletions testdata/copies-and-renames.riff-output
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

[31m-[33mThe above [7m[31mcopyright [27m[33mnotice and this permission notice shall be included in all[0m
[32m+[33mThe above notice and this permission notice shall be included in all[0m
[31m-The above [7mcopyright [27mnotice and this permission notice shall be included in all[0m
[32m+The above notice and this permission notice shall be included in all[0m
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
Expand All @@ -31,8 +31,8 @@
[36m@@ -1,6 +1,6 @@[0m
# See also .cargo/config

[31m-[33m[[7m[31mpackage[27m[33m][0m
[32m+[33m[[7m[32mpluckage[27m[33m][0m
[31m-[[7mpackage[27m][0m
[32m+[[7mpluckage[27m][0m
name = "riffdiff" # Actually "riff", but that was already taken on crates.io
version = "2.18.1"
authors = ["Johan Walles <[email protected]>"]
4 changes: 2 additions & 2 deletions testdata/dont-highlight-complete-lines.riff-output
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[1m--- [7m[22m[31mbefore[27m[1m[39m.txt[22m[2m 2023-09-24 16:22:05[0m
[1m+++ [7m[22m[32mafter[27m[1m[39m.txt[22m[2m 2023-09-24 16:22:42[0m
[36m@@ -1,1 +1,6 @@[0m
[31m-[33m let tokens = std::mem::take(&mut self.tokens);[0m
[32m+[33m let [7m[32mmut [27m[33mtokens = std::mem::take(&mut self.tokens);[0m
[31m- let tokens = std::mem::take(&mut self.tokens);[0m
[32m+ let [7mmut [27mtokens = std::mem::take(&mut self.tokens);[0m
[32m+[0m
[32m+ // FIXME: Maybe do highlight_space_between_words() before this one? And[0m
[32m+ // not do that for each line?[0m
Expand Down
4 changes: 2 additions & 2 deletions testdata/french-trailing-newline.riff-output
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[1m--- [7m[22m[31maaa[27m[2m[39m 2023-03-15 01:46:21.639805928 -0400[0m
[1m+++ [7m[22m[32mbbb[27m[2m[39m 2023-03-15 01:46:31.812927237 -0400[0m
[36m@@ -1,1 +1,1 @@[0m
[31m-[33myo[0m
[31m-yo[0m
[2m\ Pas de fin de ligne à la fin du fichier[0m
[32m+[33myo[7m[32m⏎[0m
[32m+yo[7m⏎[0m
24 changes: 12 additions & 12 deletions testdata/git-conflict-with-base-minus.riff-output
Original file line number Diff line number Diff line change
Expand Up @@ -97,24 +97,24 @@
[7m++>>>>>>> 980b661 (Remove the adds-only special highlighting feature)[0m
pub(crate) const LINE_STYLE_CONFLICT_BASE: LineStyle = {
LineStyle {
[31m -[33m prefix_style: [31mAnsiStyle {[0m
[31m - inverse: [33mtrue[31m,[0m
[31m - prefix_style: AnsiStyle {[0m
[31m - inverse: true,[0m
[31m - weight: Weight::Normal,[0m
[31m - color: Default,[0m
[31m - }[33m,[0m
[31m -[33m plain_style: [31mAnsiStyle {[0m
[31m - },[0m
[31m - plain_style: AnsiStyle {[0m
[31m - inverse: false,[0m
[31m - weight: Weight::Normal,[0m
[31m - color: [33mRed[31m,[0m
[31m - }[33m,[0m
[31m -[33m highlighted_style: [31mAnsiStyle {[0m
[31m - color: Red,[0m
[31m - },[0m
[31m - highlighted_style: AnsiStyle {[0m
[31m - inverse: true,[0m
[31m - weight: Weight::Normal,[0m
[31m - color: [33mRed[31m,[0m
[31m - }[33m,[0m
[32m +[33m prefix_style: [32mANSI_STYLE_NORMAL.with_inverse([33mtrue[32m)[33m,[0m
[32m +[33m plain_style: [32mANSI_STYLE_NORMAL.with_color([33mRed[32m)[33m,[0m
[32m +[33m highlighted_style: [32mANSI_STYLE_NORMAL.with_color([33mRed[32m).with_inverse(true)[33m,[0m
[31m - color: Red,[0m
[31m - },[0m
[32m + prefix_style: ANSI_STYLE_NORMAL.with_inverse(true),[0m
[32m + plain_style: ANSI_STYLE_NORMAL.with_color(Red),[0m
[32m + highlighted_style: ANSI_STYLE_NORMAL.with_color(Red).with_inverse(true),[0m
}
};

20 changes: 10 additions & 10 deletions testdata/git-log-n3-p.riff-output
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Date: Mon Oct 24 00:32:27 2022 +0200

[[package]]
name = "riffdiff"
[31m-[33mversion = "2.[7m[31m20[27m[33m.0"[0m
[32m+[33mversion = "2.[7m[32m21[27m[33m.0"[0m
[31m-version = "2.[7m20[27m.0"[0m
[32m+version = "2.[7m21[27m.0"[0m
dependencies = [
"backtrace",
"bytecount",
Expand All @@ -25,8 +25,8 @@ Date: Mon Oct 24 00:32:27 2022 +0200

[package]
name = "riffdiff" # Actually "riff", but that was already taken on crates.io
[31m-[33mversion = "2.[7m[31m20[27m[33m.0"[0m
[32m+[33mversion = "2.[7m[32m21[27m[33m.0"[0m
[31m-version = "2.[7m20[27m.0"[0m
[32m+version = "2.[7m21[27m.0"[0m
authors = ["Johan Walles <[email protected]>"]
edition = "2018"
repository = "https://github.com/walles/riff/"
Expand Down Expand Up @@ -57,8 +57,8 @@ Date: Mon Oct 24 00:26:59 2022 +0200

let comma = format!("{}, {}", YELLOW, NORMAL);
return format!(
[31m-[33m "{}{} ({}){}",[0m
[32m+[33m "{}{} ({}[7m[32m{}[27m[33m){}",[0m
[31m- "{}{} ({}){}",[0m
[32m+ "{}{} ({}[7m{}[27m){}",[0m
YELLOW,
commit_part,
parenthesis_parts
Expand All @@ -74,17 +74,17 @@ Date: Mon Oct 24 00:26:59 2022 +0200
[1m--- [0mtestdata/[1mgit-commit-line.riff-output[0m
[1m+++ [0mtestdata/[1mgit-commit-line.riff-output[0m
[36m@@ -1,3 +1,3 @@[0m
[31m-[33mcommit b24b967d952a8b7cf538d57d12aae8019cedada2 (HEAD -> master, tag: 2.20.0, origin/master, origin/HEAD)[0m
[32m+[33mcommit b24b967d952a8b7cf538d57d12aae8019cedada2 (HEAD -> master, tag: 2.20.0, origin/master, origin/HEAD)[0m
[31m-commit b24b967d952a8b7cf538d57d12aae8019cedada2 (HEAD -> master, tag: 2.20.0, origin/master, origin/HEAD)[0m
[32m+commit b24b967d952a8b7cf538d57d12aae8019cedada2 (HEAD -> master, tag: 2.20.0, origin/master, origin/HEAD)[0m
Author: Johan Walles <[email protected]>
Date: Wed Sep 14 19:07:05 2022 +0200
[2mdiff --git testdata/remove-file.riff-output testdata/remove-file.riff-output[0m
[2mindex 46f5a18..5a64fa1 100644[0m
[1m--- [0mtestdata/[1mremove-file.riff-output[0m
[1m+++ [0mtestdata/[1mremove-file.riff-output[0m
[36m@@ -1,4 +1,4 @@[0m
[31m-[33mcommit 90a1c38ad8b74134c24a4726f25958da4806738d (HEAD -> main)[0m
[32m+[33mcommit 90a1c38ad8b74134c24a4726f25958da4806738d (HEAD -> main)[0m
[31m-commit 90a1c38ad8b74134c24a4726f25958da4806738d (HEAD -> main)[0m
[32m+commit 90a1c38ad8b74134c24a4726f25958da4806738d (HEAD -> main)[0m
Author: Johan Walles <[email protected]>
Date: Wed Sep 14 18:57:42 2022 +0200

12 changes: 6 additions & 6 deletions testdata/highlight-middle-line.riff-output
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
println!("Evaluating example file <{}>...", diff.to_str().unwrap());

// Run highlighting on the file into a memory buffer
[31m-[33m let [7m[31mmut actual_result: Vec<u8>[27m[33m = [7m[31mVec[27m[33m::new();[0m
[31m-[33m highlight_diff(&mut fs::File::open(diff).unwrap(), [7m[31m&mut actual_result[27m[33m);[0m
[31m-[33m let actual_result = [7m[31mstr[27m[33m::[7m[31mfrom_utf8(&actual_result[27m[33m).unwrap();[0m
[32m+[33m let [7m[32mfile[27m[33m = [7m[32mtempfile::NamedTempFile[27m[33m::new()[7m[32m.unwrap()[27m[33m;[0m
[32m+[33m highlight_diff(&mut fs::File::open(diff).unwrap(), [7m[32mfile.reopen().unwrap()[27m[33m);[0m
[32m+[33m let actual_result = [7m[32mfs[27m[33m::[7m[32mread_to_string(file.path[27m[33m()[7m[32m)[27m[33m.unwrap();[0m
[31m- let [7mmut actual_result: Vec<u8>[27m = [7mVec[27m::new();[0m
[31m- highlight_diff(&mut fs::File::open(diff).unwrap(), [7m&mut actual_result[27m);[0m
[31m- let actual_result = [7mstr[27m::[7mfrom_utf8(&actual_result[27m).unwrap();[0m
[32m+ let [7mfile[27m = [7mtempfile::NamedTempFile[27m::new()[7m.unwrap()[27m;[0m
[32m+ highlight_diff(&mut fs::File::open(diff).unwrap(), [7mfile.reopen().unwrap()[27m);[0m
[32m+ let actual_result = [7mfs[27m::[7mread_to_string(file.path[27m()[7m)[27m.unwrap();[0m

// Load the corresponding .riff-output file into a string
let basename = diff.file_stem().unwrap().to_str().unwrap();
38 changes: 19 additions & 19 deletions testdata/indentation-l.riff-output
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,28 @@ Date: Wed May 6 21:52:51 2015 +0200

[31m-# Inspired by http://timelessrepo.com/making-ruby-gems[0m
begin
[31m-[33m require 'riff'[0m
[31m-[33mrescue LoadError[0m
[31m- [33m$LOAD_PATH.unshift File.join(__dir__, '..', 'lib')[0m
[31m- [33mrequire 'riff'[0m
[31m-[33mend[0m
[31m-[33mrequire 'pager'[0m
[32m+[33m [32m# Inspired by http://timelessrepo.com/making-ruby-gems[0m
[31m- require 'riff'[0m
[31m-rescue LoadError[0m
[31m- $LOAD_PATH.unshift File.join(__dir__, '..', 'lib')[0m
[31m- require 'riff'[0m
[31m-end[0m
[31m-require 'pager'[0m
[32m+ # Inspired by http://timelessrepo.com/making-ruby-gems[0m
[32m+ begin[0m
[32m+ [33mrequire 'riff'[0m
[32m+ [33mrescue LoadError[0m
[32m+ [33m$LOAD_PATH.unshift File.join(__dir__, '..', 'lib')[0m
[32m+ [33mrequire 'riff'[0m
[32m+ [33mend[0m
[32m+ [33mrequire 'pager'[0m
[32m+ require 'riff'[0m
[32m+ rescue LoadError[0m
[32m+ $LOAD_PATH.unshift File.join(__dir__, '..', 'lib')[0m
[32m+ require 'riff'[0m
[32m+ end[0m
[32m+ require 'pager'[0m

[31m-[33minclude Pager[0m
[32m+ [33minclude Pager[0m
[31m-include Pager[0m
[32m+ include Pager[0m

[31m-[33mrefined = Riff.new().do_stream(STDIN)[0m
[31m-[33mpage(refined)[0m
[32m+ [33mrefined = Riff.new().do_stream(STDIN)[0m
[32m+ [33mpage(refined)[0m
[31m-refined = Riff.new().do_stream(STDIN)[0m
[31m-page(refined)[0m
[32m+ refined = Riff.new().do_stream(STDIN)[0m
[32m+ page(refined)[0m
[32m+rescue => e[0m
[32m+ STDERR.puts[0m
[32m+ STDERR.puts e.to_s[0m
Expand Down
4 changes: 2 additions & 2 deletions testdata/issue-15.riff-output
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

after_rebase() {
# Verify that upstream's test suite passes
[31m-[33m bazelisk test -- //src/test/java/build/buildfarm:all[0m
[32m+[33m bazelisk test --[7m[32mtest_output=errors --[27m[33m //src/test/java/build/buildfarm:all[0m
[31m- bazelisk test -- //src/test/java/build/buildfarm:all[0m
[32m+ bazelisk test --[7mtest_output=errors --[27m //src/test/java/build/buildfarm:all[0m

# Push rebased changes back to Spotify's fork of upstream
git push -u origin HEAD
4 changes: 2 additions & 2 deletions testdata/issue-with-incomplete-output.riff-output
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
use crate::refiner::to_highlighted_tokens;
use crate::string_future::StringFuture;
use crate::token_collector::{
[31m-[33m lowlight_timestamp, render, unhighlight_git_prefix, LINE_STYLE_NEW_FILENAME,[0m
[32m+[33m [7m[32malign_tabs, [27m[33mlowlight_timestamp, render, unhighlight_git_prefix, LINE_STYLE_NEW_FILENAME,[0m
[31m- lowlight_timestamp, render, unhighlight_git_prefix, LINE_STYLE_NEW_FILENAME,[0m
[32m+ [7malign_tabs, [27mlowlight_timestamp, render, unhighlight_git_prefix, LINE_STYLE_NEW_FILENAME,[0m
LINE_STYLE_OLD_FILENAME,
};

Expand Down
10 changes: 5 additions & 5 deletions testdata/merge-two-way.riff-output
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ Date: Thu Jan 25 08:57:37 2024 +0100
[1m+++ file.txt[0m
[36m@@@ -1,10 -1,8 +1,9 @@@[0m
This is the first line.
[31m -[33mThis line [7m[31mwill be[27m[33m edited in the main branch.[0m
[32m +[33mThis line [7m[32mwas[27m[33m edited in the main branch.[0m
[31m -This line [7mwill be[27m edited in the main branch.[0m
[32m +This line [7mwas[27m edited in the main branch.[0m
This is placeholder line one.
[31m- This line will be removed in the branch.[0m
This is placeholder line two.
Expand All @@ -27,7 +27,7 @@ Date: Thu Jan 25 08:57:37 2024 +0100
Hello.
This is placeholder line five.
This is placeholder line six.
[31m- [33m-> A prefix will be added to this line on main, a suffix on branch and the middle [7m[31mwill be[27m[33m changed during conflict resolution.[0m
[31m -[33mA prefix will be added to this line on main, a suffix on branch and the middle [7m[31mwill be[27m[33m changed during conflict resolution. <-[0m
[32m++[7m-> [27m[33mA prefix will be added to this line on main, a suffix on branch and the middle [7m[32mwas[27m[33m changed during conflict resolution.[7m[32m <-[0m
[31m- -> A prefix will be added to this line on main, a suffix on branch and the middle [7mwill be[27m changed during conflict resolution.[0m
[31m -A prefix will be added to this line on main, a suffix on branch and the middle [7mwill be[27m changed during conflict resolution. <-[0m
[32m++[7m-> [27mA prefix will be added to this line on main, a suffix on branch and the middle [7mwas[27m changed during conflict resolution.[7m <-[0m
This is placeholder line seven.
22 changes: 11 additions & 11 deletions testdata/moar-570d780b.riff-output
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
}

// NewReaderFromStream creates a new stream reader
[31m-[33mfunc NewReaderFromStream(name [7m[31m*[27m[33mstring, reader io.Reader) *Reader {[0m
[31m-func NewReaderFromStream(name [7m*[27mstring, reader io.Reader) *Reader {[0m
[32m+//[0m
[32m+// The name can be an empty string ("").[0m
[32m+//[0m
[32m+// If non-empty, the name will be displayed by the pager in the bottom left[0m
[32m+// corner to help the user keep track of what is being paged.[0m
[32m+[33mfunc NewReaderFromStream(name string, reader io.Reader) *Reader {[0m
[32m+func NewReaderFromStream(name string, reader io.Reader) *Reader {[0m
mReader := newReaderFromStream(reader, nil)
[31m-[33m mReader.lock.Lock()[0m
[31m- [33mmReader.name = name[0m
[31m- [33mmReader.lock.Unlock()[0m
[31m- mReader.lock.Lock()[0m
[31m- mReader.name = name[0m
[31m- mReader.lock.Unlock()[0m
[32m+[0m
[32m+[33m [32mif len(name) > 0 {[0m
[32m+ [33mmReader.lock.Lock()[0m
[32m+ [33mmReader.name = [7m[32m&[27m[33mname[0m
[32m+ [33mmReader.lock.Unlock()[0m
[32m+ if len(name) > 0 {[0m
[32m+ mReader.lock.Lock()[0m
[32m+ mReader.name = [7m&[27mname[0m
[32m+ mReader.lock.Unlock()[0m
[32m+ }[0m

return mReader
Expand All @@ -30,8 +30,8 @@
return nil, err
}

[31m-[33m reader := NewReaderFromStream([7m[31m&[27m[33mfilename, stream)[0m
[32m+[33m reader := NewReaderFromStream(filename, stream)[0m
[31m- reader := NewReaderFromStream([7m&[27mfilename, stream)[0m
[32m+ reader := NewReaderFromStream(filename, stream)[0m
return reader, nil
}

4 changes: 2 additions & 2 deletions testdata/no-newline-in-context.riff-output
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[1m--- [0m/tmp/dom/[7m[31mapa[27m[1m[39m.txt[22m[2m 2024-02-04 08:36:46[0m
[1m+++ [0m/tmp/dom/[7m[32mbepa[27m[1m[39m.txt[22m[2m 2024-02-04 08:37:13[0m
[36m@@ -1,2 +1,2 @@[0m
[31m-[7mChange this[27m[33m line[0m
[32m+[7mThis[27m[33m line[7m[32m was changed[0m
[31m-[7mChange this[27m line[0m
[32m+[7mThis[27m line[7m was changed[0m
This line has no EOL
[2m\ No newline at end of file[0m
4 changes: 2 additions & 2 deletions testdata/non-breakable-spaces.riff-output
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
[1m--- [7m[22m[31mapa[0m
[1m+++ [7m[22m[32mbepa[0m
[36m@@ -1,1 +1,1 @@[0m
[31m-[7m<br/>[27m[33m`            s.remove(i ‑ 1);[0m
[32m+[33m`            s.remove(i ‑ 1);[0m
[31m-[7m<br/>[27m`            s.remove(i ‑ 1);[0m
[32m+`            s.remove(i ‑ 1);[0m
8 changes: 4 additions & 4 deletions testdata/partial-refine.riff-output
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
}

fn print(stream: &mut BufWriter<&mut dyn Write>, text: &str) {
[31m-[33m stream.write_all(text.as_bytes()).[7m[31munwrap[27m[33m();[0m
[32m+[33m [7m[32mif let Err(error) = [27m[33mstream.write_all(text.as_bytes())[32m {[0m
[32m+ if error[33m.[7m[32mkind[27m[33m()[32m == ErrorKind::BrokenPipe {[0m
[31m- stream.write_all(text.as_bytes()).[7munwrap[27m();[0m
[32m+ [7mif let Err(error) = [27mstream.write_all(text.as_bytes()) {[0m
[32m+ if error.[7mkind[27m() == ErrorKind::BrokenPipe {[0m
[32m+ // This is fine, somebody probably just quit their pager before it[0m
[32m+ // was done reading our output.[0m
[32m+ exit(0);[0m
[32m+ }[0m
[32m+[0m
[32m+ panic!("Error writing diff to pager: {:?}", error)[33m;[0m
[32m+ panic!("Error writing diff to pager: {:?}", error);[0m
[32m+ }[0m
}

Expand Down
6 changes: 3 additions & 3 deletions testdata/prepended-lines.riff-output
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
# Build the current version
print()
print("Building current sources...")
[31m-[33m subprocess.run(["cargo", "build", "--release"], check=True)[0m
[32m+[33m [32mbuildenv = os.environ.copy()[0m
[31m- subprocess.run(["cargo", "build", "--release"], check=True)[0m
[32m+ buildenv = os.environ.copy()[0m
[32m+ buildenv["RUSTFLAGS"] = "-Awarnings"[0m
[32m+ [33msubprocess.run(["cargo", "build", "--release"], check=True[7m[32m, env=buildenv[27m[33m)[0m
[32m+ subprocess.run(["cargo", "build", "--release"], check=True[7m, env=buildenv[27m)[0m
shutil.copy("target/release/riff", os.path.join(BINDIR, "riff-current"))


4 changes: 2 additions & 2 deletions testdata/remove-trailing-newline.riff-output
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[1m--- [7m[22m[31mbefore[27m[1m[39m.txt[22m[2m 2023-09-24 16:19:05[0m
[1m+++ [7m[22m[32mafter[27m[1m[39m.txt[22m[2m 2023-09-24 16:19:08[0m
[36m@@ -1,1 +1,1 @@[0m
[31m-[33mapor[7m[31m⏎[0m
[32m+[33mapor[0m
[31m-apor[7m⏎[0m
[32m+apor[0m
[2m\ No newline at end of file[0m
Loading

0 comments on commit 2f94a8c

Please sign in to comment.