diff options
author | Dave Davenport <qball@gmpclient.org> | 2017-08-29 10:40:24 +0200 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2017-08-29 10:40:24 +0200 |
commit | 508e39c3f3ff2fab3ef8d5ccf740df83539b9557 (patch) | |
tree | bc7658b2f064c7bc65cbac1f22f14129af198021 | |
parent | 73e174b67bb6ddca05f505a9af15b250193b01aa (diff) |
Set cursor to end of input field.
Fixes: #662
-rw-r--r-- | include/widgets/textbox.h | 7 | ||||
-rw-r--r-- | source/view.c | 1 | ||||
-rw-r--r-- | source/widgets/textbox.c | 9 |
3 files changed, 9 insertions, 8 deletions
diff --git a/include/widgets/textbox.h b/include/widgets/textbox.h index ec6f85f0..b330045b 100644 --- a/include/widgets/textbox.h +++ b/include/widgets/textbox.h @@ -313,5 +313,12 @@ PangoAttrList *textbox_get_pango_attributes ( textbox *tb ); */ const char *textbox_get_visible_text ( const textbox *tb ); int textbox_get_desired_width ( widget *wid ); + +/** + * @param tb Handle to the textbox + * + * Move the cursor to the end of the string. + */ +void textbox_cursor_end ( textbox *tb ); /*@}*/ #endif //ROFI_TEXTBOX_H diff --git a/source/view.c b/source/view.c index 9f3b3c59..476a3085 100644 --- a/source/view.c +++ b/source/view.c @@ -1696,6 +1696,7 @@ RofiViewState *rofi_view_create ( Mode *sw, if ( state->text && input ) { textbox_text ( state->text, input ); + textbox_cursor_end ( state->text ); } state->overlay = textbox_create ( WIDGET_TYPE_TEXTBOX_TEXT, "window.overlay", TB_AUTOWIDTH | TB_AUTOHEIGHT, URGENT, "blaat", 0.5, 0 ); diff --git a/source/widgets/textbox.c b/source/widgets/textbox.c index 64d4fa5a..a2854ff3 100644 --- a/source/widgets/textbox.c +++ b/source/widgets/textbox.c @@ -49,13 +49,6 @@ static int textbox_get_width ( widget * ); static int _textbox_get_height ( widget * ); static void __textbox_update_pango_text ( textbox *tb ); -/** - * @param tb Handle to the textbox - * - * Move the cursor to the end of the string. - */ -static void textbox_cursor_end ( textbox *tb ); - /** Default pango context */ static PangoContext *p_context = NULL; /** The pango font metrics */ @@ -585,7 +578,7 @@ static void textbox_cursor_dec_word ( textbox *tb ) } // end of line -static void textbox_cursor_end ( textbox *tb ) +void textbox_cursor_end ( textbox *tb ) { if ( tb->text == NULL ) { tb->cursor = 0; |