From 5152e147e9a053482f6a4895f3d2028864f6cf2f Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 11 Sep 2019 09:26:38 +0300 Subject: [PATCH] Handle home and end keys in Entry widget --- source/entry.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source/entry.cpp b/source/entry.cpp index 87f88c7..9f99e79 100644 --- a/source/entry.cpp +++ b/source/entry.cpp @@ -153,6 +153,18 @@ bool Entry::key_press(unsigned key, unsigned) check_view_range(); rebuild(); } + else if(key==Input::KEY_END) + { + unsigned row, col; + text.offset_to_coords(edit_pos, row, col); + set_edit_position(text.coords_to_offset(row, text.get_line_length(row))); + } + else if(key==Input::KEY_HOME) + { + unsigned row, col; + text.offset_to_coords(edit_pos, row, col); + set_edit_position(text.coords_to_offset(row, 0)); + } else return false; -- 2.43.0