mirror of
https://github.com/davatorium/rofi.git
synced 2025-01-27 15:25:24 -05:00
fix issue #165
This commit is contained in:
parent
300234611d
commit
09e4a64780
3 changed files with 18 additions and 12 deletions
|
@ -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++ ) {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue