Make popup smaller on char deletion

This commit is contained in:
daa 2018-02-27 22:24:17 +03:00
parent fc7016caa9
commit 4eb025ba91
2 changed files with 5 additions and 3 deletions

View File

@ -26,8 +26,6 @@ pub struct Level {
impl Level { impl Level {
//TODO: double width chars render, also note in text wrapping //TODO: double width chars render, also note in text wrapping
//TODO: im //TODO: im
//TODO: cursor
//TODO: delete
pub fn replace_from_ctx(&mut self, ctx: &CmdLineContext, render_state: &shell::RenderState) { pub fn replace_from_ctx(&mut self, ctx: &CmdLineContext, render_state: &shell::RenderState) {
let content = ctx.get_lines(); let content = ctx.get_lines();

View File

@ -95,7 +95,11 @@ impl ModelLayout {
row_idx += 1; 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<(Option<Attrs>, Vec<char>)>>, max_columns: usize) -> usize { fn count_lines(lines: &Vec<Vec<(Option<Attrs>, Vec<char>)>>, max_columns: usize) -> usize {