From 94c9303d8987683f5d7b281207c9fc92337cd9e0 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Wed, 6 May 2015 08:03:10 +0200 Subject: [PATCH] Fix issue #160. Return selected line. --- source/rofi.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) 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;