From e166fa3d8e11552c8a1ad3cdec1f58f4a8aa602a Mon Sep 17 00:00:00 2001 From: QC Date: Tue, 13 Jan 2015 11:48:38 +0100 Subject: Move indicator to end of entry box. --- source/helper.c | 5 +++-- source/rofi.c | 27 +++++++++++++++------------ 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/source/helper.c b/source/helper.c index 5a67e2bb..5ae6f171 100644 --- a/source/helper.c +++ b/source/helper.c @@ -124,7 +124,8 @@ char *token_collate_key ( const char *token, int case_sensitive ) if ( case_sensitive ) { tmp = g_strdup ( token ); - } else { + } + else { tmp = g_utf8_casefold ( token, -1 ); } @@ -273,7 +274,7 @@ int token_match ( char **tokens, const char *input, int case_sensitive, __attribute__( ( unused ) ) int index, __attribute__( ( unused ) ) void *data ) { - int match = 1; + int match = 1; char *compk = token_collate_key ( input, case_sensitive ); // Do a tokenized match. diff --git a/source/rofi.c b/source/rofi.c index 36d0c75b..b1688b43 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -1200,7 +1200,7 @@ static void menu_mouse_navigation ( MenuState *state, XButtonEvent *xbe ) } static void menu_refilter ( MenuState *state, char **lines, menu_match_cb mmc, void *mmc_data, - int sorting, int case_sensitive ) + int sorting, int case_sensitive ) { unsigned int i, j = 0; if ( strlen ( state->text->text ) > 0 ) { @@ -1419,21 +1419,23 @@ MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prom NORMAL, "*" ); state.prompt_tb = textbox_create ( main_window, TB_AUTOHEIGHT | TB_AUTOWIDTH, - ( config.padding ) + textbox_get_width ( state.case_indicator ), + ( config.padding ), ( config.padding ), 0, 0, NORMAL, prompt ); state.text = textbox_create ( main_window, TB_AUTOHEIGHT | TB_EDITABLE, - ( config.padding ) + textbox_get_width ( state.prompt_tb ) - + textbox_get_width ( state.case_indicator ), + ( config.padding ) + textbox_get_width ( state.prompt_tb ), ( config.padding ), ( ( config.hmode == TRUE ) ? state.element_width : ( state.w - ( 2 * ( config.padding ) ) ) ) - textbox_get_width ( state.prompt_tb ) - - textbox_get_width ( state.case_indicator ), 1, + - textbox_get_width ( state.case_indicator ), 0, NORMAL, ( input != NULL ) ? *input : "" ); - + // Move indicator to end. + textbox_move ( state.case_indicator, + state.w - ( 2 * ( config.padding ) ) - textbox_get_width ( state.case_indicator ), + 0 ); textbox_show ( state.text ); textbox_show ( state.prompt_tb ); @@ -1635,14 +1637,15 @@ MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prom } // Toggle case sensitivity. else if ( key == XK_grave ) { - config.case_sensitive = !config.case_sensitive; + config.case_sensitive = !config.case_sensitive; *( state.selected_line ) = 0; - state.refilter = TRUE; - state.update = TRUE; + state.refilter = TRUE; + state.update = TRUE; if ( config.case_sensitive ) { - textbox_show ( state.case_indicator ); - } else { - textbox_hide ( state.case_indicator ); + textbox_show ( state.case_indicator ); + } + else { + textbox_hide ( state.case_indicator ); } } // Switcher short-cut -- cgit v1.2.3