mookid / diffr

Yet another diff highlighting tool
MIT License
575 stars 22 forks source link

[WIP] Line numbers #43

Closed mookid closed 4 years ago

mookid commented 4 years ago

re #21

@noc7c9 please let me know what you think! the basic functionality should work on this branch, even if the code is not completely ready for merging.

noc7c9 commented 4 years ago

Hey, thanks for working on this!

I think there's a couple issues though:

Here's an example:

diff --git a/src/main.rs b/src/main.rs
index a9d484a..ddc448c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,4 +1,4 @@
2: -use atty::{is, Stream};
 :2+use atty::{is, Stream}; // Notice: this is labeled as 2 despite being line #1
 :3
 :4 use std::fmt::Debug;
 :5 use std::fmt::Display;
@@ -6,6 +6,11 @@ use std::fmt::{Error as FmtErr, Formatter};
  : 7 use std::io::{self, BufRead};
  : 8 use std::iter::Peekable;
  : 9 use std::time::SystemTime;
  :10+
  :11+// add bunch of lines for next example
  :12+
  :13+
  :14+
10:15 use termcolor::{
11:16     Color,
12:17     Color::{Green, Red, White},
@@ -19,6 +24,7 @@ mod cli_args;
25:20
26:21 #[derive(Debug)]
27:22 pub struct AppConfig {
  :23+    // Notice: how the new lines are less than the old lines despite lines being added to the file
28:24     debug: bool,
29:25     added_face: ColorSpec,
30:26     refine_added_face: ColorSpec,

By the way, would you like any help with this feature? My Rust isn't the greatest but I'd love to lend a hand if you'd like. I'd always meant to implement this myself eventually, but was too busy. But work is closing soon (last week!) meaning I have some free time.

mookid commented 4 years ago

@noc7c9 sure, you can have it.

mookid commented 4 years ago

Integrated (#44)