This commit is contained in:
Qball Cow 2015-05-19 19:59:50 +02:00
parent 300234611d
commit 09e4a64780
3 changed files with 18 additions and 12 deletions

View File

@ -23,12 +23,12 @@ typedef struct
typedef enum
{
TB_AUTOHEIGHT = 1 << 0,
TB_AUTOWIDTH = 1 << 1,
TB_LEFT = 1 << 16,
TB_RIGHT = 1 << 17,
TB_CENTER = 1 << 18,
TB_EDITABLE = 1 << 19,
TB_AUTOHEIGHT = 1 << 0,
TB_AUTOWIDTH = 1 << 1,
TB_LEFT = 1 << 16,
TB_RIGHT = 1 << 17,
TB_CENTER = 1 << 18,
TB_EDITABLE = 1 << 19,
} TextboxFlags;

View File

@ -181,7 +181,7 @@ static void dmenu_output_formatted_line ( const char *format, const char *string
int dmenu_switcher_dialog ( char **input )
{
char *dmenu_prompt = "dmenu ";
int selected_line = 0;
int selected_line = -1;
int retv = FALSE;
int length = 0;
char **list = get_dmenu ( &length );
@ -223,7 +223,7 @@ int dmenu_switcher_dialog ( char **input )
char *select = NULL;
find_arg_str ( "-select", &select );
if ( select != NULL && find_arg ( "-filter" ) >= 0 ) {
if ( select != NULL /*&& find_arg ( "-filter" ) >= 0 */ ) {
char **tokens = tokenize ( select, config.case_sensitive );
int i = 0;
for ( i = 0; i < length; i++ ) {

View File

@ -1070,13 +1070,19 @@ MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prom
state.selected = 0;
// The cast to unsigned in here is valid, we checked if selected_line > 0.
// So its maximum range is 0-2³¹, well within the num_lines range.
if ( ( *( state.selected_line ) ) >= 0 && (unsigned int) ( *( state.selected_line ) ) <= state.num_lines ) {
state.selected = *( state.selected_line );
}
// if ( ( *( state.selected_line ) ) >= 0 && (unsigned int) ( *( state.selected_line ) ) <= state.num_lines ) {
// state.selected = *( state.selected_line );
// }
state.quit = FALSE;
menu_refilter ( &state, lines, mmc, mmc_data, sorting, config.case_sensitive );
for ( unsigned int i = 0; ( *( state.selected_line ) ) >= 0 && !state.selected && i < state.filtered_lines; i++ ) {
if ( state.line_map[i] == *( state.selected_line ) ) {
state.selected = i;
}
}
int x11_fd = ConnectionNumber ( display );
while ( !state.quit ) {
// Update if requested.
@ -1910,7 +1916,7 @@ int main ( int argc, char *argv[] )
SwitcherMode switcher_run ( char **input, Switcher *sw )
{
char *prompt = g_strdup_printf ( "%s:", sw->name );
int selected_line = 0;
int selected_line = -1;
unsigned int cmd_list_length = 0;
char **cmd_list = NULL;