summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/view-internal.h5
-rw-r--r--source/dialogs/dmenu.c7
-rw-r--r--source/view.c11
3 files changed, 17 insertions, 6 deletions
diff --git a/include/view-internal.h b/include/view-internal.h
index 70c8f2ff..10b42260 100644
--- a/include/view-internal.h
+++ b/include/view-internal.h
@@ -40,6 +40,11 @@ struct RofiViewState
listview *list_view;
/** #textbox widget showing the overlay. */
textbox *overlay;
+ /** #container holding the message box */
+ container *mesg_box;
+ /** #textbox containing the message entry */
+ textbox *mesg_tb;
+
/** Array with the levenshtein distance for each eleemnt. */
int *distance;
/** Array with the translation between the filtered and unfiltered list. */
diff --git a/source/dialogs/dmenu.c b/source/dialogs/dmenu.c
index 5a264fdd..725b6a2e 100644
--- a/source/dialogs/dmenu.c
+++ b/source/dialogs/dmenu.c
@@ -110,12 +110,17 @@ static void async_close_callback ( GObject *source_object, GAsyncResult *res, G_
static void read_add ( DmenuModePrivateData * pd, char *data, gsize len )
{
+ if ( pd->cmd_list_real_length > 0 ){
+ if ( find_arg ( "-replace" ) >= 0 ){
+ g_free(pd->cmd_list[pd->cmd_list_length]);
+ pd->cmd_list_length--;
+ }
+ }
if ( ( pd->cmd_list_length + 2 ) > pd->cmd_list_real_length ) {
pd->cmd_list_real_length = MAX ( pd->cmd_list_real_length * 2, 512 );
pd->cmd_list = g_realloc ( pd->cmd_list, ( pd->cmd_list_real_length ) * sizeof ( char* ) );
}
char *utfstr = rofi_force_utf8 ( data, len );
-
pd->cmd_list[pd->cmd_list_length] = utfstr;
pd->cmd_list[pd->cmd_list_length + 1] = NULL;
diff --git a/source/view.c b/source/view.c
index 7eb18ce6..7fd03485 100644
--- a/source/view.c
+++ b/source/view.c
@@ -1592,12 +1592,13 @@ RofiViewState *rofi_view_create ( Mode *sw,
box_add ( state->input_bar, WIDGET ( state->text ), TRUE, 2 );
textbox_text ( state->case_indicator, get_matching_state () );
- if ( message ) {
- container *box = container_create ( "window.mainbox.message.box" );
- textbox *message_tb = textbox_create ( "window.mainbox.message.textbox", TB_AUTOHEIGHT | TB_MARKUP | TB_WRAP, NORMAL, message );
- container_add ( box, WIDGET ( message_tb ) );
- box_add ( state->main_box, WIDGET ( box ), FALSE, end ? 8 : 2 );
+ state->mesg_box = container_create ( "window.mainbox.message.box" );
+ state->mesg_tb = textbox_create ( "window.mainbox.message.textbox", TB_AUTOHEIGHT | TB_MARKUP | TB_WRAP, NORMAL, message );
+ container_add ( state->mesg_box, WIDGET ( state->mesg_tb ) );
+ if ( message == NULL ) {
+ widget_disable ( WIDGET( state->mesg_box ) );
}
+ box_add ( state->main_box, WIDGET ( state->mesg_box ), FALSE, end ? 8 : 2 );
state->overlay = textbox_create ( "window.overlay", TB_AUTOWIDTH | TB_AUTOHEIGHT, URGENT, "blaat" );
state->overlay->widget.parent = WIDGET ( state->main_window );