From 4eb025ba918e1b8dfeb87a6f51516c352be505d8 Mon Sep 17 00:00:00 2001 From: daa Date: Tue, 27 Feb 2018 22:24:17 +0300 Subject: [PATCH] Make popup smaller on char deletion --- src/cmd_line.rs | 2 -- src/ui_model/model_layout.rs | 6 +++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cmd_line.rs b/src/cmd_line.rs index b83db66..8ae848b 100644 --- a/src/cmd_line.rs +++ b/src/cmd_line.rs @@ -26,8 +26,6 @@ pub struct Level { impl Level { //TODO: double width chars render, also note in text wrapping //TODO: im - //TODO: cursor - //TODO: delete pub fn replace_from_ctx(&mut self, ctx: &CmdLineContext, render_state: &shell::RenderState) { let content = ctx.get_lines(); diff --git a/src/ui_model/model_layout.rs b/src/ui_model/model_layout.rs index aaac0f8..4bf172f 100644 --- a/src/ui_model/model_layout.rs +++ b/src/ui_model/model_layout.rs @@ -95,7 +95,11 @@ impl ModelLayout { row_idx += 1; } - self.cols_filled = max(self.cols_filled, max_col_idx + 1); + if self.rows_filled == 1 { + self.cols_filled = max_col_idx + 1; + } else { + self.cols_filled = max(self.cols_filled, max_col_idx + 1); + } } fn count_lines(lines: &Vec, Vec)>>, max_columns: usize) -> usize {