Skip to content

Edit the first search result if available #523

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xozzslip
Copy link

@xozzslip xozzslip commented Aug 8, 2024

I often use Ctrl+R to search for commands with the intention of editing them rather than executing. Typically, I find myself wanting to edit the first command that appears in the search results.

@dvorka dvorka requested review from Copilot and dvorka May 9, 2025 06:53
@dvorka dvorka self-assigned this May 9, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements the behavior to edit the first search result if available when not in favorites view.

  • Added a conditional branch in loop_to_select() to update the result from the first entry in the selection array.
  • Falls back to the original pattern assignment if no selection exists.

@@ -1598,7 +1598,11 @@ void loop_to_select(void)
favorites_choose(hstr->favorites,result);
}
} else {
Copy link
Preview

Copilot AI May 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Add a comment explaining that when the search results are not empty, the first result is selected for editing; this will help maintain clarity for future maintainers.

Suggested change
} else {
} else {
// If there are search results, select the first result for editing.

Copilot uses AI. Check for mistakes.

@dvorka dvorka assigned xozzslip and unassigned dvorka May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants