From 1809fde1c778edda7b1b04db499d038f1fc65ca6 Mon Sep 17 00:00:00 2001 From: John Mitchell <startoaster23@gmail.com> Date: Thu, 17 Nov 2022 14:00:05 -0500 Subject: [PATCH] Format code. --- src/widgets/text_box.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/widgets/text_box.rs b/src/widgets/text_box.rs index 73df76c..2ba680c 100644 --- a/src/widgets/text_box.rs +++ b/src/widgets/text_box.rs @@ -218,12 +218,18 @@ pub fn text_box_render( let cursor_pos = state.cursor_position; if is_backspace(c) { if !state.current_value.is_empty() { - let char_pos: usize = state.graphemes[0..cursor_pos - 1].iter().map(|g| g.len()).sum(); + let char_pos: usize = state.graphemes[0..cursor_pos - 1] + .iter() + .map(|g| g.len()) + .sum(); state.current_value.remove(char_pos); state.cursor_position -= 1; } } else if !c.is_control() { - let char_pos: usize = state.graphemes[0..cursor_pos].iter().map(|g| g.len()).sum(); + let char_pos: usize = state.graphemes[0..cursor_pos] + .iter() + .map(|g| g.len()) + .sum(); state.current_value.insert(char_pos, c); state.cursor_position += 1; -- GitLab