Skip to content

Edit the first search result if available#523

Open
xozzslip wants to merge 1 commit into
dvorka-oss:masterfrom
xozzslip:master
Open

Edit the first search result if available#523
xozzslip wants to merge 1 commit into
dvorka-oss:masterfrom
xozzslip:master

Conversation

@xozzslip

@xozzslip xozzslip commented Aug 8, 2024

Copy link
Copy Markdown

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

Copilot AI left a comment

Copy link
Copy Markdown

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.

Comment thread src/hstr.c
@@ -1598,7 +1598,11 @@ void loop_to_select(void)
favorites_choose(hstr->favorites,result);
}
} else {

Copilot AI May 9, 2025

Copy link

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.

3 participants