Set cursor to end of input field.

Fixes: #662
This commit is contained in:
Dave Davenport 2017-08-29 10:40:24 +02:00
parent 73e174b67b
commit 508e39c3f3
3 changed files with 9 additions and 8 deletions

View File

@ -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

View File

@ -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 );

View File

@ -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;