From fd0d1e3c22c49192a1e979c30627f1707a2146da Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Wed, 17 Jan 2024 22:28:11 +0100 Subject: [PATCH] add toggle of alt_buf after line skip #59 --- members/libpt-bintols/src/hedu/mod.rs | 7 ++++++- src/hedu/mod.rs | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/members/libpt-bintols/src/hedu/mod.rs b/members/libpt-bintols/src/hedu/mod.rs index fa32521..efe0bf0 100644 --- a/members/libpt-bintols/src/hedu/mod.rs +++ b/members/libpt-bintols/src/hedu/mod.rs @@ -139,12 +139,17 @@ pub fn dump(data: &mut dyn DataSource, mut config: HeduConfig) -> Result<()> { ); let start_line = config.data_idx; while config.buf[0] == config.buf[1] && config.len == BYTES_PER_LINE { - rd_data(data, &mut config)?; // FIXME: incorrect logic #59 + rd_data(data, &mut config)?; } + config.alt_buf ^= 1; // toggle the alt buf (now that we have a not same line) config.display_buf += &format!( "^^^^^^^^ {LINE_SEP_VERT} (repeats {} lines)", (config.data_idx - start_line) / (BYTES_PER_LINE * 2) ); + trace!( + buf = format!("{:X?}", config.buf), + "dumping buf after line skip" + ); config.display(); } // switch to the second half of the buf, the original half is stored the old buffer diff --git a/src/hedu/mod.rs b/src/hedu/mod.rs index 4e72881..84cf0e6 100644 --- a/src/hedu/mod.rs +++ b/src/hedu/mod.rs @@ -86,6 +86,7 @@ pub struct Cli { /// a data source, probably a file. /// /// If left empty or set as "-", the program will read from stdin. + // TODO: take many sources #60 pub data_source: Option, }