Skip to content

User menu: select first item that matches the condition, not second #4725

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 30, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/usermenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ user_menu_cmd (const Widget *edit_widget, const char *menu_file, int selected_en
int max_cols = 0;
int col = 0;
gboolean accept_entry = TRUE;
int selected = 0;
int selected = -1;
gboolean old_patterns;
gboolean res = FALSE;
gboolean interactive = TRUE;
Expand Down Expand Up @@ -1063,7 +1063,7 @@ user_menu_cmd (const Widget *edit_widget, const char *menu_file, int selected_en
{
// Combined adding and default
p = test_line (edit_widget, p + 1, &accept_entry);
if (selected == 0 && accept_entry)
if (selected < 0 && accept_entry)
selected = menu_lines;
}
else
Expand All @@ -1078,7 +1078,7 @@ user_menu_cmd (const Widget *edit_widget, const char *menu_file, int selected_en
{
// Combined adding and default
p = test_line (edit_widget, p + 1, &accept_entry);
if (selected == 0 && accept_entry)
if (selected < 0 && accept_entry)
selected = menu_lines;
}
else
Expand All @@ -1087,7 +1087,7 @@ user_menu_cmd (const Widget *edit_widget, const char *menu_file, int selected_en
gboolean ok = TRUE;

p = test_line (edit_widget, p, &ok);
if (selected == 0 && ok)
if (selected < 0 && ok)
selected = menu_lines;
}
break;
Expand Down
Loading