From 9de15284d86637fd0bd588757f1d0e292d9bbaf8 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Sun, 20 Oct 2019 10:52:41 +0300 Subject: [PATCH] ui: initialise cursor in fields at the end By convention and usability reasons, the cursor in a text field should be initialised at the end of the string. --- ui/src/terminal/text_editing.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/src/terminal/text_editing.rs b/ui/src/terminal/text_editing.rs index 01173c1ea..5433b6036 100644 --- a/ui/src/terminal/text_editing.rs +++ b/ui/src/terminal/text_editing.rs @@ -10,9 +10,9 @@ pub struct UText { impl UText { pub fn new(content: String) -> Self { UText { + cursor_pos: content.len(), + grapheme_cursor_pos: content.split_graphemes().len(), content, - cursor_pos: 0, - grapheme_cursor_pos: 0, } }