Skip to content

fix: qol fixes for keybindings - #7709

Merged
lohit-bruno merged 7 commits into
usebruno:mainfrom
shubh-bruno:fix/keybindings-tests
Apr 15, 2026
Merged

lohit-bruno merged 7 commits into
usebruno:mainfrom
shubh-bruno:fix/keybindings-tests

Conversation

@shubh-bruno

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

Copy link
Copy Markdown
Collaborator

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

    • Disable replace shortcut in read‑only editors; editor inputs now capture global shortcuts reliably.
    • Windows reserved shortcuts list adjusted to reduce conflicts.
    • Env saves prefixed with "dotenv:" follow the specialized save flow.
    • Transient tabs are no longer recorded for reopening.
  • New Features

    • Request URL field can run/submit directly from the editor.
  • Style

    • Keybindings UI spacing, keycap sizing, and row styles updated; reset button disabled when no custom bindings and shows success toast.

@coderabbitai

coderabbitai Bot commented Apr 8, 2026 •

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Code/editor keybindings and Preferences Keybindings UI updated; CodeMirror replace shortcut disabled in read-only editors; QueryEditor adds mousetrap class to input; Windows reserved shortcuts list changed; dotenv environment saves now dispatch a window event; NewRequest wires the URL editor’s run to form submit. (41 words)

Changes

Cohort / File(s) Summary
Code editor keymaps
packages/bruno-app/src/components/CodeEditor/index.js, packages/bruno-app/src/components/RequestPane/QueryEditor/index.js
Cmd-H/Ctrl-H binding now returns false when this.props.readOnly; QueryEditor adds mousetrap CSS class to CodeMirror input to allow global shortcuts while focused.
Keybindings UI & rules
packages/bruno-app/src/components/Preferences/Keybindings/index.js, packages/bruno-app/src/components/Preferences/Keybindings/StyledWrapper.js
Adjusted Windows reserved shortcuts (removed many command+..., added alt+tab, alt+shift+tab, alt+esc, alt+space, f11, f12, ctrl+y), added toast on reset, disabled Reset when no custom keybindings, changed duplicate-shortcut message text, added spacer rows and various styling tweaks.
Environment save routing
packages/bruno-app/src/components/RequestTabs/RequestTab/index.js
If focused tab is environment-settings and environmentUid starts with dotenv:, dispatch window.dispatchEvent(new Event('dotenv-save')) instead of calling Redux saveEnvironment.
New request submit behavior
packages/bruno-app/src/components/Sidebar/NewRequest/index.js
Removed form-level Enter onKeyDown handler; wired SingleLineEditor onRun to formik.handleSubmit() so editor run triggers submission.
Tabs/transient flag
packages/bruno-app/src/providers/ReduxStore/middlewares/tasks/middleware.js, packages/bruno-app/src/providers/ReduxStore/slices/tabs.js
addTab propagation may include isTransient: true for transient items; addTab and closeTabs now persist/omit isTransient to prevent transient tabs from landing in recently-closed.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant RequestTab
    participant Window
    participant Redux
    User->>RequestTab: Trigger save on environment-settings tab
    alt environmentUid starts with "dotenv:"
        RequestTab->>Window: dispatch Event("dotenv-save")
        Window-->>RequestTab: external handler processes dotenv save
    else non-dotenv environmentUid
        RequestTab->>Redux: dispatch saveEnvironment(variables, environmentUid, collectionUid)
        Redux-->>RequestTab: save result/ack
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • helloanoop
  • lohit-bruno
  • naman-bruno

Poem

Keys soft as whispers, shortcuts steer,
Read-only hushes replace from here,
Dotenv taps the window's bell,
Enter runs the URL so well,
Tiny shifts — the editor cheers. 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title references keybindings QoL fixes, which is a secondary aspect of the changeset; the PR also addresses transient request handling, environment save shortcuts, and Enter key behavior.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 previously approved these changes Apr 9, 2026
@sid-bruno sid-bruno changed the title fix: keybindings issues fix: qol fixes for keybindings Apr 9, 2026
bijin-bruno
bijin-bruno previously approved these changes Apr 11, 2026
@helloanoop

Copy link
Copy Markdown
Contributor

@shubh-bruno Is there anyway we could add a playwright test to ensure that issue #7347 (cmd + h ignored when the output window is in focus) does not regress ever again ?

@shubh-bruno

shubh-bruno commented Apr 11, 2026 •

Copy link
Copy Markdown
Collaborator Author

@helloanoop i can't think of anything right now as it gets intercepted at OS level, window gets hidden so Playwright assertions are possible out of electron

@shubh-bruno
shubh-bruno dismissed stale reviews from bijin-bruno and sid-bruno via b988578 April 13, 2026 10:57
@pull-request-size pull-request-size Bot added size/L and removed size/M labels Apr 13, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/bruno-app/src/components/Preferences/Keybindings/StyledWrapper.js`:
- Around line 252-260: Replace the hardcoded hex backgrounds in the
StyledWrapper styled-component for the selectors "tbody tr.row-success td" and
"tbody tr.row-error td" with theme tokens accessed via the styled-components
theme prop (e.g. use ${({ theme }) => theme.colors.status.successBackground} and
${({ theme }) => theme.colors.status.errorBackground} or the appropriate
existing token names in your theme). Update both normal and :hover rules so they
reference the same theme tokens (or derived/alpha variants from theme) instead
of literal hex values to preserve token-driven theming consistency.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c86a32dd-6ddc-4103-8bca-f55007231805

📥 Commits

Reviewing files that changed from the base of the PR and between e041ddd and b988578.

📒 Files selected for processing (3)
  • packages/bruno-app/src/components/Preferences/Keybindings/StyledWrapper.js
  • packages/bruno-app/src/components/Preferences/Keybindings/index.js
  • packages/bruno-app/src/components/RequestPane/QueryEditor/index.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/bruno-app/src/components/Preferences/Keybindings/index.js

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/bruno-app/src/components/Preferences/Keybindings/index.js`:
- Around line 577-580: hasCustomizedKeybindings currently checks only entry
count so stale entries that match defaults still mark the prefs dirty; change it
to compute whether any user override actually differs from the default by
iterating preferences.keyBindings and comparing each entry to the corresponding
value in the defaults (considering OS-specific defaults) and return true only if
there is at least one differing entry; additionally update commitCombo so that
after computing nextKeys you check against the default for that action/OS and if
they are equal you remove that action from preferences.keyBindings (instead of
writing the default back) otherwise persist the override — this ensures both
hasCustomizedKeybindings and the Reset Default state reflect true diffs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3104dc3c-fa03-45e1-95ad-ec0816530799

📥 Commits

Reviewing files that changed from the base of the PR and between b988578 and b6a5cd5.

📒 Files selected for processing (1)
  • packages/bruno-app/src/components/Preferences/Keybindings/index.js

sid-bruno
sid-bruno previously approved these changes Apr 14, 2026
@lohit-bruno
lohit-bruno merged commit 9822cee into usebruno:main Apr 15, 2026
10 checks passed
lohit-bruno pushed a commit that referenced this pull request Apr 22, 2026
* fix: keybindings issues

* chore: let SingleLineEditor handle it's own handleSubmit

* fix: resolve issues

* fix: disable reset default if none are changed

* fix: exlude transient request from reopen last closed tabs

* fix: updated all hardcoded colors to respective theme colors

* chore: pick color from theme

---------

Co-authored-by: shubh-bruno <[email protected]>
Co-authored-by: Sid <[email protected]>
@bhavik168 bhavik168 mentioned this pull request Jun 12, 2026
2 tasks done
@coderabbitai coderabbitai Bot mentioned this pull request Jul 1, 2026
4 of 6 tasks
sid-bruno added a commit to sid-bruno/bruno that referenced this pull request Aug 21, 2026
* fix: keybindings issues

* chore: let SingleLineEditor handle it's own handleSubmit

* fix: resolve issues

* fix: disable reset default if none are changed

* fix: exlude transient request from reopen last closed tabs

* fix: updated all hardcoded colors to respective theme colors

* chore: pick color from theme

---------

Co-authored-by: shubh-bruno <[email protected]>
Co-authored-by: shubh-bruno <[email protected]>
Co-authored-by: Sid <[email protected]>
sid-bruno pushed a commit to sid-bruno/bruno that referenced this pull request Aug 21, 2026
sid-bruno pushed a commit to sid-bruno/bruno that referenced this pull request Aug 21, 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

6 participants