1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-07 17:59:16 +00:00

Enter to select the next step

This commit is contained in:
Tw93
2025-10-14 19:18:03 +08:00
parent 5ec2ca0c46
commit 05e3ec78dc
2 changed files with 31 additions and 3 deletions

View File

@@ -637,7 +637,26 @@ paginated_multi_select() {
draw_menu
continue
fi
# In normal mode: confirm and exit with current selections
# In normal mode: smart Enter behavior
# 1. Check if any items are already selected
local has_selection=false
for ((i = 0; i < total_items; i++)); do
if [[ ${selected[i]} == true ]]; then
has_selection=true
break
fi
done
# 2. If nothing selected, auto-select current item
if [[ $has_selection == false ]]; then
local idx=$((top_index + cursor_pos))
if [[ $idx -lt ${#view_indices[@]} ]]; then
local real="${view_indices[idx]}"
selected[real]=true
fi
fi
# 3. Confirm and exit with current selections
local -a selected_indices=()
for ((i = 0; i < total_items; i++)); do
if [[ ${selected[i]} == true ]]; then