Skip to content

fix: qol fixes for keybindings#7709

Open
shubh-bruno wants to merge 2 commits intousebruno:mainfrom
shubh-bruno:fix/keybindings-tests
Open

fix: qol fixes for keybindings#7709
shubh-bruno wants to merge 2 commits intousebruno:mainfrom
shubh-bruno:fix/keybindings-tests

Conversation

@shubh-bruno
Copy link
Copy Markdown
Collaborator

@shubh-bruno shubh-bruno commented Apr 8, 2026

Description

JIRA

Also fixes : #7347

  • Correction to the default maps for windows
  • Fix the Enter keyboard shortcut on the new request modal
  • Fix .env file table save shortcut

Contribution Checklist:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.

Publishing to New Package Managers

Please see here for more information.

Summary by CodeRabbit

  • Bug Fixes

    • Editor shortcuts now respect read-only mode and are disabled when appropriate.
    • Windows-reserved keyboard mappings updated for better OS compatibility.
    • Saving for environment entries prefixed with "dotenv:" now follows the correct save flow.
  • New Features

    • Request URL field supports direct execution via the editor's run/submit action.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 8, 2026

Walkthrough

Keyboard shortcut handling was adjusted: CodeEditor disables replace shortcuts in read-only mode; Keybindings updated Windows-reserved combos; RequestTab routes dotenv-prefixed environment saves via a window event; NewRequest wires the Request URL editor's run action to form submission. (50 words)

Changes

Cohort / File(s) Summary
Code editor & keybinding rules
packages/bruno-app/src/components/CodeEditor/index.js, packages/bruno-app/src/components/Preferences/Keybindings/index.js
CodeEditor now conditionally disables Cmd-H/Ctrl-H replace shortcut when readOnly is truthy. Keybindings adjusted for Windows OS reservations: removed prior command-based entries and added alt+tab, alt+shift+tab, alt+esc, alt+space, f11, f12, and ctrl+y to the reserved set.
Environment save routing
packages/bruno-app/src/components/RequestTabs/RequestTab/index.js
For focused environment-settings tabs where collection.environmentsDraft.environmentUid starts with dotenv:, save now dispatches window.dispatchEvent(new Event('dotenv-save')) instead of invoking the Redux saveEnvironment action.
New request submission behavior
packages/bruno-app/src/components/Sidebar/NewRequest/index.js
Removed global Enter onKeyDown submit handler; added onRun prop on SingleLineEditor for Request URL to call formik.handleSubmit() so running the editor triggers form submission.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant RequestTab
    participant Window
    participant Redux
    User->>RequestTab: Trigger save (environment-settings)
    alt UID starts with "dotenv:"
        RequestTab->>Window: dispatch Event("dotenv-save")
        Window-->>RequestTab: Event handled externally
    else Non-dotenv UID
        RequestTab->>Redux: dispatch saveEnvironment(variables, uid, collectionUid)
        Redux-->>RequestTab: save result
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • helloanoop
  • lohit-bruno
  • bijin-bruno
  • naman-bruno

Poem

⌨️ Shortcuts hushed when editors rest,
Dotenv whispers ride the window's crest,
Enter no longer jumps the line,
URL-run calls the form just fine,
Tiny fixes, smooth and blessed. 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title 'fix: qol fixes for keybindings' accurately describes the changeset, which modifies keybinding-related logic across multiple components and updates reserved OS shortcuts.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
packages/bruno-app/src/components/RequestTabs/RequestTab/index.js (1)

224-238: ⚠️ Potential issue | 🟠 Major

Handle global dotenv saves in the shortcut path too.

Line 237 still always dispatches saveGlobalEnvironment(...). For a global-environment-settings tab with a dotenv: UID, Cmd/Ctrl+S will bypass the new custom save flow even though the save-and-close path already routes those drafts through dotenv-save. Please mirror the same prefix check here so both save paths stay consistent.

Suggested fix
     } else if (tab.type === 'global-environment-settings') {
       if (globalEnvironmentDraft) {
         const { environmentUid, variables } = globalEnvironmentDraft;
-        dispatch(saveGlobalEnvironment({ variables, environmentUid }));
+        if (environmentUid?.startsWith('dotenv:')) {
+          window.dispatchEvent(new Event('dotenv-save'));
+        } else {
+          dispatch(saveGlobalEnvironment({ variables, environmentUid }));
+        }
       }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/bruno-app/src/components/RequestTabs/RequestTab/index.js` around
lines 224 - 238, The save keybinding path (useKeybinding handler) ignores dotenv
global drafts: update the branch handling tab.type ===
'global-environment-settings' to mirror the environment-settings flow by
extracting { environmentUid, variables } from globalEnvironmentDraft and
checking if environmentUid?.startsWith('dotenv:'); if it does, fire the same
window.dispatchEvent(new Event('dotenv-save')) used elsewhere, otherwise
continue to dispatch(saveGlobalEnvironment({ variables, environmentUid })); this
ensures both Cmd/Ctrl+S and save-and-close use the dotenv-save flow for dotenv
UIDs.
packages/bruno-app/src/components/Preferences/Keybindings/index.js (1)

220-239: ⚠️ Potential issue | 🟠 Major

Don’t widen Windows-only reservations into the Linux path.

Because Line 15 maps every non-mac platform to 'windows', these new entries will be rejected on Linux too. That means alt+space, f11, ctrl+y, etc. become unavailable there even though this table is meant to describe Windows-specific reservations. Please split Linux into its own reserved set before expanding this list.

As per coding guidelines, Bruno is a cross-platform Electron desktop app that runs on macOS, Windows, and Linux. Ensure that all code is OS-agnostic.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/bruno-app/src/components/Preferences/Keybindings/index.js` around
lines 220 - 239, The current reserved shortcut set named windows (built via
comboSignature) is being applied to all non-mac platforms; create a separate
linux reserved set (e.g., linux: new Set([...]) using comboSignature for
Linux-specific entries) and update the platform-to-reserved-set mapping (the
logic that currently maps every non-mac platform to 'windows') so Linux uses the
new 'linux' set while Windows continues to use 'windows'; ensure comboSignature
references remain unchanged and only the reserved sets and platform selection
logic are adjusted so Linux shortcuts like alt+space, f11, ctrl+y are not
incorrectly rejected.
packages/bruno-app/src/components/CodeEditor/index.js (1)

76-88: ⚠️ Potential issue | 🟠 Major

Update extraKeys when readOnly changes to keep Cmd/Ctrl-H binding in sync.

Lines 87-88 compute the replace binding once at mount. When readOnly flips after mount, line 262 only updates the readOnly option—the key binding remains stale. Add an extraKeys update in the same conditional block:

Example fix
if (this.props.readOnly !== prevProps.readOnly && this.editor) {
  this.editor.setOption('readOnly', this.props.readOnly);
  this.editor.setOption('extraKeys', {
    ...this.editor.getOption('extraKeys'),
    'Cmd-H': this.props.readOnly ? false : 'replace',
    'Ctrl-H': this.props.readOnly ? false : 'replace',
  });
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/bruno-app/src/components/CodeEditor/index.js` around lines 76 - 88,
The Cmd-H/Ctrl-H key bindings in extraKeys are only set at mount and become
stale when readOnly changes; update the CodeMirror extraKeys whenever readOnly
flips by, inside the existing readOnly-change block that uses this.editor,
calling this.editor.getOption('extraKeys') to merge current keys and then
this.editor.setOption('extraKeys', merged) with 'Cmd-H' and 'Ctrl-H' set to
this.props.readOnly ? false : 'replace' (keep the existing
this.editor.setOption('readOnly', this.props.readOnly') call).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@packages/bruno-app/src/components/CodeEditor/index.js`:
- Around line 76-88: The Cmd-H/Ctrl-H key bindings in extraKeys are only set at
mount and become stale when readOnly changes; update the CodeMirror extraKeys
whenever readOnly flips by, inside the existing readOnly-change block that uses
this.editor, calling this.editor.getOption('extraKeys') to merge current keys
and then this.editor.setOption('extraKeys', merged) with 'Cmd-H' and 'Ctrl-H'
set to this.props.readOnly ? false : 'replace' (keep the existing
this.editor.setOption('readOnly', this.props.readOnly') call).

In `@packages/bruno-app/src/components/Preferences/Keybindings/index.js`:
- Around line 220-239: The current reserved shortcut set named windows (built
via comboSignature) is being applied to all non-mac platforms; create a separate
linux reserved set (e.g., linux: new Set([...]) using comboSignature for
Linux-specific entries) and update the platform-to-reserved-set mapping (the
logic that currently maps every non-mac platform to 'windows') so Linux uses the
new 'linux' set while Windows continues to use 'windows'; ensure comboSignature
references remain unchanged and only the reserved sets and platform selection
logic are adjusted so Linux shortcuts like alt+space, f11, ctrl+y are not
incorrectly rejected.

In `@packages/bruno-app/src/components/RequestTabs/RequestTab/index.js`:
- Around line 224-238: The save keybinding path (useKeybinding handler) ignores
dotenv global drafts: update the branch handling tab.type ===
'global-environment-settings' to mirror the environment-settings flow by
extracting { environmentUid, variables } from globalEnvironmentDraft and
checking if environmentUid?.startsWith('dotenv:'); if it does, fire the same
window.dispatchEvent(new Event('dotenv-save')) used elsewhere, otherwise
continue to dispatch(saveGlobalEnvironment({ variables, environmentUid })); this
ensures both Cmd/Ctrl+S and save-and-close use the dotenv-save flow for dotenv
UIDs.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d47697ff-ab72-4ee2-bb46-cfe87c6163a8

📥 Commits

Reviewing files that changed from the base of the PR and between 3b502fd and 6b26f0a.

📒 Files selected for processing (4)
  • packages/bruno-app/src/components/CodeEditor/index.js
  • packages/bruno-app/src/components/Preferences/Keybindings/index.js
  • packages/bruno-app/src/components/RequestTabs/RequestTab/index.js
  • packages/bruno-app/src/components/Sidebar/NewRequest/index.js

@sid-bruno sid-bruno changed the title fix: keybindings issues fix: qol fixes for keybindings Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The cmd + h ignored when the output window is in focus

2 participants