Skip to content

Conversation

@RohitKushvaha01
Copy link
Member

@RohitKushvaha01 RohitKushvaha01 commented Jan 10, 2026

Closes #1427

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @RohitKushvaha01, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the user experience by implementing a common and intuitive keyboard shortcut, Ctrl+F (or Cmd+F), to manage the search dialog. This change allows users to quickly dismiss the search interface and return focus to the main editor, thereby streamlining their workflow and improving overall navigation efficiency within the application.

Highlights

  • Keyboard Shortcut for Search Dialog: Introduced the ability to close the search dialog using the Ctrl+F (or Cmd+F on macOS) keyboard shortcut.
  • Event Listener Modification: Modified the keydown event listener on the search input to detect the Ctrl+F / Cmd+F combination.
  • Focus Management: Upon pressing the shortcut, the editor is automatically focused, and the search dialog's visibility is toggled.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds a Ctrl+F shortcut to close the search dialog when the search input is focused. My review points out a potential issue with the implementation where using toggleSearch() can lead to unexpected behavior, such as clearing the search input or not closing the dialog under certain conditions. I've suggested a more direct approach to ensure the dialog closes as intended.

Comment on lines +88 to +90
const { editor, activeFile } = editorManager;
editor.focus();
toggleSearch();
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Calling toggleSearch() here can lead to unintended side effects. For example:

  • If there is text selected in the editor, it might replace the content of the search input instead of closing the search dialog.
  • If the search input is not empty and there is no selection in the editor, it will clear the search input.

This is likely not the desired behavior when the user presses Ctrl+F with the intent to close the search dialog. A more direct approach is to call the action that closes the search bar from the actionStack. This ensures that the search dialog is always closed as intended.

Additionally, activeFile is declared but never used.

Suggested change
const { editor, activeFile } = editorManager;
editor.focus();
toggleSearch();
const { editor } = editorManager;
editor.focus();
actionStack.get("search-bar")?.action();

@greptile-apps
Copy link

greptile-apps bot commented Jan 10, 2026

Greptile Overview

Greptile Summary

This PR adds the ability to close (or toggle) the search dialog by pressing Ctrl+F (or Cmd+F on Mac) when the search input has focus.

Implementation Details

The change adds a keydown event handler to the search input that:

  1. Detects Ctrl+F or Cmd+F keypresses
  2. Prevents the default browser search behavior
  3. Focuses the editor
  4. Calls toggleSearch() to handle the search dialog state

Behavior

The actual behavior is more nuanced than just "closing" the search:

  • If the editor has selected text different from the current search input → the search input is updated with the selected text
  • If the editor has no selection or the selection matches the search input → the search dialog closes

This provides an intelligent UX where users can either close the search or update it with newly selected text, depending on context.

Code Quality

The implementation follows existing patterns in the codebase and integrates cleanly with the existing toggleSearch() function. One minor style issue was found: an unused activeFile variable that should be removed.

Confidence Score: 4/5

  • This PR is safe to merge with only minor style improvements needed
  • The implementation is straightforward and integrates well with existing code patterns. The logic correctly handles the toggle behavior by reusing the existing toggleSearch() function. The only issue found is a minor style concern (unused variable) that doesn't affect functionality. The change is well-contained, uses standard event handling patterns, and doesn't introduce security risks or breaking changes.
  • No files require special attention - the single change is simple and low-risk

Important Files Changed

File Analysis

Filename Score Overview
src/handlers/quickTools.js 4/5 Added Ctrl+F handler in search input to toggle search dialog. Implementation is sound with one minor style issue (unused variable). The handler intelligently closes the search or updates it with selected text depending on context.

Sequence Diagram

sequenceDiagram
    participant User
    participant SearchInput
    participant KeyHandler
    participant Editor
    participant toggleSearch
    participant ActionStack

    User->>SearchInput: Press Ctrl+F
    SearchInput->>KeyHandler: keydown event
    KeyHandler->>KeyHandler: Check (ctrlKey || metaKey) && key === 'f'
    KeyHandler->>KeyHandler: preventDefault()
    KeyHandler->>Editor: focus()
    KeyHandler->>toggleSearch: toggleSearch()
    toggleSearch->>Editor: getSelectedText()
    Editor-->>toggleSearch: selectedText
    
    alt Search already open
        alt selectedText != inputValue
            toggleSearch->>SearchInput: Update value with selectedText
            toggleSearch->>Editor: find(0, false)
            toggleSearch-->>KeyHandler: return (search updated)
        else selectedText == inputValue
            toggleSearch->>ActionStack: get("search-bar").action()
            ActionStack->>toggleSearch: removeSearch()
            toggleSearch->>SearchInput: Remove from DOM
            toggleSearch-->>KeyHandler: return (search closed)
        end
    else Search not open
        toggleSearch->>SearchInput: Create and show search
        toggleSearch->>ActionStack: push search close action
        toggleSearch->>SearchInput: focus()
        toggleSearch-->>KeyHandler: return (search opened)
    end
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

if (e.key === "ArrowUp") {
if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "f") {
e.preventDefault();
const { editor, activeFile } = editorManager;
Copy link

Choose a reason for hiding this comment

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

The activeFile variable is destructured but never used in this code block. Consider removing it to keep the code clean.

Suggested change
const { editor, activeFile } = editorManager;
const { editor } = editorManager;

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/handlers/quickTools.js
Line: 88:88

Comment:
The `activeFile` variable is destructured but never used in this code block. Consider removing it to keep the code clean.

```suggestion
				const { editor } = editorManager;
```

<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>

How can I resolve this? If you propose a fix, please make it concise.

@RohitKushvaha01 RohitKushvaha01 merged commit d301d6b into Acode-Foundation:main Jan 11, 2026
6 checks passed
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.

Improve search dialog

2 participants