From e5cac79829412088b396d18891c82a9a327df771 Mon Sep 17 00:00:00 2001 From: Nathan Vegdahl Date: Sun, 16 Feb 2020 17:14:36 +0900 Subject: [PATCH] Fix for two bugs from the previous refactor. --- Cargo.toml | 3 +++ src/formatter.rs | 2 +- src/term_ui/mod.rs | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index e5c92d0..a862328 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,9 @@ edition = "2018" name = "led" path = "src/main.rs" +[profile.release] +debug = true + [dependencies] ropey = "1" # ropey = { git = "https://github.com/cessen/ropey", branch = "master" } diff --git a/src/formatter.rs b/src/formatter.rs index 9774f4f..a598402 100644 --- a/src/formatter.rs +++ b/src/formatter.rs @@ -147,7 +147,7 @@ impl LineFormatter { // Get the vertical size of the block and the vertical // position of the char_idx within it. - let block_v_dim = (block_vis_iter.clone().last().unwrap().1).0 + 1; + let block_v_dim = block_vis_iter.clone().last().map(|n| (n.1).0).unwrap_or(0) + 1; let char_v_pos = block_vis_iter.clone().vpos(char_offset); // Get the char's vertical position within the block after offset diff --git a/src/term_ui/mod.rs b/src/term_ui/mod.rs index 9118f60..27e18e9 100644 --- a/src/term_ui/mod.rs +++ b/src/term_ui/mod.rs @@ -606,6 +606,8 @@ impl TermUI { char_index += char_count(&g); } + + screen_line += 1; } // If we get here, it means we reached the end of the text buffer