diff options
author | Canop <cano.petrole@gmail.com> | 2021-11-30 22:17:11 +0100 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2021-11-30 22:17:11 +0100 |
commit | ffaa167cfcc97f5197e9291a88918cbf889c9f08 (patch) | |
tree | ed62af15b6339f02716f5c53037944f481621af9 | |
parent | dbc814424d72554488c8131b040ec8126a05672a (diff) |
fix hex view sometimes losing 1 or 2 ASCII characters
-rw-r--r-- | CHANGELOG.md | 3 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | src/hex/hex_view.rs | 8 |
3 files changed, 10 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index b083d00..dc25fbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +### next +- Fix 1 or 2 characters of the right ASCII column in hex view sometimes lost + <a name="v1.7.3"></a> ### v1.7.3 - 2021-11-19 - Fix rendering artefacts on Windows, like a duplicate input line @@ -1,6 +1,6 @@ [package] name = "broot" -version = "1.7.3" +version = "1.7.4-dev" authors = ["dystroy <denys.seguret@gmail.com>"] repository = "https://github.com/Canop/broot" documentation = "https://dystroy.org/broot" diff --git a/src/hex/hex_view.rs b/src/hex/hex_view.rs index 40c072d..66de990 100644 --- a/src/hex/hex_view.rs +++ b/src/hex/hex_view.rs @@ -103,7 +103,7 @@ impl HexView { let page = self.get_page(self.scroll, line_count)?; let addresses_len = if self.len < 0xffff { 4 - } else if self.len < 0xffffff { + } else if self.len < 0xff_ffff { 6 } else { 8 @@ -116,7 +116,11 @@ impl HexView { let mut chars_middle_space = false; let mut inter_hex = false; let mut chars = false; - let mut rem = area.width as i32 - 32; // 32: minimum, tight + const MIN: i32 = + 1 // margin + + 32 // 32 hex + + 1; // scrollbar + let mut rem = area.width as i32 - MIN; if rem > 17 { chars = true; rem -= 17; |