]> git.tdb.fi Git - libs/gltk.git/commitdiff
Handle home and end keys in Entry widget
authorMikko Rasa <tdb@tdb.fi>
Wed, 11 Sep 2019 06:26:38 +0000 (09:26 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 11 Sep 2019 06:26:38 +0000 (09:26 +0300)
source/entry.cpp

index 87f88c75eadd39f94929f21745b131f363a394e6..9f99e794c5e3c7cb98fc0564242af21aac79f172 100644 (file)
@@ -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;