From c0d7f013782ed5c55a8dd05f389ed110c7ebf982 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Thu, 12 Sep 2019 14:05:33 +0300 Subject: [PATCH] Use the public functions also in internal edit operations of Entry --- source/entry.cpp | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/source/entry.cpp b/source/entry.cpp index 6d13ccd..21064f7 100644 --- a/source/entry.cpp +++ b/source/entry.cpp @@ -252,25 +252,17 @@ bool Entry::key_press(unsigned key, unsigned mod) if(selection_active) erase_selection(); else if(edit_pos>0) - { - text.erase(--edit_pos, 1); - check_view_range(); - rebuild(); - } + erase(edit_pos-1, 1); } else if(key==Input::KEY_DELETE) { if(selection_active) erase_selection(); else - text.erase(edit_pos, 1); + erase(edit_pos, 1); } else if(key==Input::KEY_ENTER && multiline) - { - text.insert(edit_pos++, "\n"); - check_view_range(); - rebuild(); - } + insert(edit_pos, "\n"); else if(key==Input::KEY_END) { unsigned row, col; @@ -303,9 +295,7 @@ bool Entry::character(wchar_t ch) { if(selection_active) erase_selection(); - text.insert(edit_pos, StringCodec::encode(StringCodec::ustring(1, ch))); - ++edit_pos; - rebuild(); + insert(edit_pos, StringCodec::encode(StringCodec::ustring(1, ch))); return true; } -- 2.43.0