add toggle of alt_buf after line skip #59
cargo devel CI / cargo CI (push) Successful in 1m59s Details

This commit is contained in:
Christoph J. Scherr 2024-01-17 22:28:11 +01:00
parent ee62e1e578
commit fd0d1e3c22
Signed by: PlexSheep
GPG Key ID: 7CDD0B14851A08EF
2 changed files with 7 additions and 1 deletions

View File

@ -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

View File

@ -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<String>,
}