7
7
Written by:
8
8
Slava Zanko <[email protected] >, 2013
9
9
Andrew Borodin <[email protected] >, 2013
10
+ Vadim Kalinnikov <[email protected] >, 2025
10
11
11
12
This file is part of the Midnight Commander.
12
13
@@ -1042,6 +1043,8 @@ user_menu_cmd (const Widget *edit_widget, const char *menu_file, int selected_en
1042
1043
1043
1044
old_patterns = easy_patterns ;
1044
1045
1046
+ gboolean found_default = FALSE;
1047
+
1045
1048
// Parse the menu file
1046
1049
for (p = check_patterns (data ); * p != '\0' ; str_next_char (& p ))
1047
1050
{
@@ -1063,8 +1066,11 @@ user_menu_cmd (const Widget *edit_widget, const char *menu_file, int selected_en
1063
1066
{
1064
1067
// Combined adding and default
1065
1068
p = test_line (edit_widget , p + 1 , & accept_entry );
1066
- if (selected == 0 && accept_entry )
1069
+ if (!found_default && accept_entry )
1070
+ {
1067
1071
selected = menu_lines ;
1072
+ found_default = TRUE;
1073
+ }
1068
1074
}
1069
1075
else
1070
1076
{
@@ -1078,17 +1084,23 @@ user_menu_cmd (const Widget *edit_widget, const char *menu_file, int selected_en
1078
1084
{
1079
1085
// Combined adding and default
1080
1086
p = test_line (edit_widget , p + 1 , & accept_entry );
1081
- if (selected == 0 && accept_entry )
1082
- selected = menu_lines ;
1087
+ if (!found_default && accept_entry )
1088
+ {
1089
+ selected = menu_lines ;
1090
+ found_default = TRUE;
1091
+ }
1083
1092
}
1084
1093
else
1085
1094
{
1086
1095
// A condition for making the entry default
1087
1096
gboolean ok = TRUE;
1088
1097
1089
1098
p = test_line (edit_widget , p , & ok );
1090
- if (selected == 0 && ok )
1099
+ if (!found_default && ok )
1100
+ {
1091
1101
selected = menu_lines ;
1102
+ found_default = TRUE;
1103
+ }
1092
1104
}
1093
1105
break ;
1094
1106
0 commit comments