Skip to content

Commit 6b7dcab

Browse files
authored
Fix added/removed bytes being visually misaligned in data diff view (#159)
1 parent e202c3e commit 6b7dcab

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

objdiff-gui/src/views/data_diff.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ fn data_row_ui(
149149
let base_color = get_color_for_diff_kind(diff.kind, appearance);
150150
if diff.data.is_empty() {
151151
let mut str = " ".repeat(diff.len);
152-
str.push_str(" ".repeat(diff.len / 8).as_str());
152+
let n1 = cur_addr / 8;
153+
let n2 = (diff.len + cur_addr) / 8;
154+
str.push_str(" ".repeat(n2 - n1).as_str());
153155
write_text(str.as_str(), base_color, &mut job, appearance.code_font.clone());
154156
cur_addr += diff.len;
155157
} else {

0 commit comments

Comments
 (0)