Skip to content
Snippets Groups Projects
Commit 1809fde1 authored by John Mitchell's avatar John Mitchell
Browse files

Format code.

parent 3d1f68f2
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment