From e20cedb11300eb45ef051e80d064ea937df73722 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sun, 17 Jul 2022 10:56:37 +0000 Subject: feat(input.rs): refresh and validate wrap width --- src/app.rs | 2 +- src/command.rs | 10 +++++++++- src/input.rs | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/app.rs b/src/app.rs index a773319..d6a9a2d 100644 --- a/src/app.rs +++ b/src/app.rs @@ -111,7 +111,7 @@ impl App { items = self.items.items.clone(); } - items.push((vec![format!("{}", response.meta().to_string())], None)); + items.push((vec![response.meta().to_string()], None)); items.push((vec!["".to_string()], None)); if let Some(content) = response.content().clone() { diff --git a/src/command.rs b/src/command.rs index f17b235..66f3139 100644 --- a/src/command.rs +++ b/src/command.rs @@ -38,7 +38,15 @@ impl From for Command { }, |at| { match at.parse() { - Ok(at_parsed) => Self::Wrap(at_parsed, None), + Ok(at_parsed) => + Self::Wrap( + if at_parsed == 0 { + crossterm::terminal::size().unwrap_or((80, 24)).0 + } else { + at_parsed + }, + None, + ), Err(error) => Self::Wrap(80, Some(error.to_string())), } }, diff --git a/src/input.rs b/src/input.rs index 76b6b60..1e8e083 100644 --- a/src/input.rs +++ b/src/input.rs @@ -184,6 +184,8 @@ fn handle_editing_input( } else { app.error = None; app.wrap_at = at; + + app.make_request(); }, } -- cgit v1.2.3