Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/handlers/quickTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,12 @@ function setupHistoryNavigation() {
// Search input history navigation
if ($searchInput.el) {
$searchInput.el.addEventListener("keydown", (e) => {
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.

editor.focus();
toggleSearch();
Comment on lines +88 to +90
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();

} else if (e.key === "ArrowUp") {
e.preventDefault();
const newValue = searchHistory.navigateSearchUp($searchInput.el.value);
$searchInput.el.value = newValue;
Expand Down