Repository navigation
fix: qol fixes for keybindings - #7709
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughCode/editor keybindings and Preferences Keybindings UI updated; CodeMirror replace shortcut disabled in read-only editors; QueryEditor adds Changes
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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 | 🟠 MajorHandle global dotenv saves in the shortcut path too.
Line 237 still always dispatches
saveGlobalEnvironment(...). For aglobal-environment-settingstab with adotenv:UID,Cmd/Ctrl+Swill bypass the new custom save flow even though the save-and-close path already routes those drafts throughdotenv-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 | 🟠 MajorDon’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 meansalt+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 | 🟠 MajorUpdate
extraKeyswhenreadOnlychanges to keep Cmd/Ctrl-H binding in sync.Lines 87-88 compute the replace binding once at mount. When
readOnlyflips after mount, line 262 only updates thereadOnlyoption—the key binding remains stale. Add anextraKeysupdate 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
📒 Files selected for processing (4)
packages/bruno-app/src/components/CodeEditor/index.jspackages/bruno-app/src/components/Preferences/Keybindings/index.jspackages/bruno-app/src/components/RequestTabs/RequestTab/index.jspackages/bruno-app/src/components/Sidebar/NewRequest/index.js
|
@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 ? |
|
@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 |
There was a problem hiding this comment.
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
📒 Files selected for processing (3)
packages/bruno-app/src/components/Preferences/Keybindings/StyledWrapper.jspackages/bruno-app/src/components/Preferences/Keybindings/index.jspackages/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
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
packages/bruno-app/src/components/Preferences/Keybindings/index.js
* 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]>
* 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]>
This reverts commit 9718a36.
…" (usebruno#1260) This reverts commit 9718a36.
Description
JIRA
Also fixes : #7347
Contribution Checklist:
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
New Features
Style