diff --git a/source/rofi.c b/source/rofi.c index aea06999..2e2b5b60 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -1178,46 +1178,73 @@ MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prom } } else if ( abe_test_action ( CUSTOM_1, ev.xkey.state, key ) ) { + if ( state.selected < state.filtered_lines ) { + *( state.selected_line ) = state.line_map[state.selected]; + } state.retv = MENU_QUICK_SWITCH | ( 0 & MENU_LOWER_MASK ); state.quit = TRUE; break; } else if ( abe_test_action ( CUSTOM_2, ev.xkey.state, key ) ) { + if ( state.selected < state.filtered_lines ) { + *( state.selected_line ) = state.line_map[state.selected]; + } state.retv = MENU_QUICK_SWITCH | ( 1 & MENU_LOWER_MASK ); state.quit = TRUE; break; } else if ( abe_test_action ( CUSTOM_3, ev.xkey.state, key ) ) { + if ( state.selected < state.filtered_lines ) { + *( state.selected_line ) = state.line_map[state.selected]; + } state.retv = MENU_QUICK_SWITCH | ( 2 & MENU_LOWER_MASK ); state.quit = TRUE; break; } else if ( abe_test_action ( CUSTOM_4, ev.xkey.state, key ) ) { + if ( state.selected < state.filtered_lines ) { + *( state.selected_line ) = state.line_map[state.selected]; + } state.retv = MENU_QUICK_SWITCH | ( 3 & MENU_LOWER_MASK ); state.quit = TRUE; break; } else if ( abe_test_action ( CUSTOM_5, ev.xkey.state, key ) ) { + if ( state.selected < state.filtered_lines ) { + *( state.selected_line ) = state.line_map[state.selected]; + } state.retv = MENU_QUICK_SWITCH | ( 4 & MENU_LOWER_MASK ); state.quit = TRUE; break; } else if ( abe_test_action ( CUSTOM_6, ev.xkey.state, key ) ) { + if ( state.selected < state.filtered_lines ) { + *( state.selected_line ) = state.line_map[state.selected]; + } state.retv = MENU_QUICK_SWITCH | ( 5 & MENU_LOWER_MASK ); state.quit = TRUE; break; } else if ( abe_test_action ( CUSTOM_7, ev.xkey.state, key ) ) { + if ( state.selected < state.filtered_lines ) { + *( state.selected_line ) = state.line_map[state.selected]; + } state.retv = MENU_QUICK_SWITCH | ( 6 & MENU_LOWER_MASK ); state.quit = TRUE; break; } else if ( abe_test_action ( CUSTOM_8, ev.xkey.state, key ) ) { + if ( state.selected < state.filtered_lines ) { + *( state.selected_line ) = state.line_map[state.selected]; + } state.retv = MENU_QUICK_SWITCH | ( 7 & MENU_LOWER_MASK ); state.quit = TRUE; break; } else if ( abe_test_action ( CUSTOM_9, ev.xkey.state, key ) ) { + if ( state.selected < state.filtered_lines ) { + *( state.selected_line ) = state.line_map[state.selected]; + } state.retv = MENU_QUICK_SWITCH | ( 8 & MENU_LOWER_MASK ); state.quit = TRUE; break;