From: Mikko Rasa Date: Wed, 11 Sep 2019 06:26:38 +0000 (+0300) Subject: Handle home and end keys in Entry widget X-Git-Url: http://git.tdb.fi/?p=libs%2Fgltk.git;a=commitdiff_plain;h=5152e147e9a053482f6a4895f3d2028864f6cf2f Handle home and end keys in Entry widget --- 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;