mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-22 16:25:58 +00:00
fix(desktop): accept shift modifier for keyboard zoom-in on macOS (#43517)
Surgical reapply of the surviving half of PR #43517 by @jingsong-liu (the branch predates the ts-ify migration; its other half — zoom restore after reload/navigation — landed via #66989). On US layouts Plus is physically Shift+=, so Cmd+Plus arrives with the shift modifier set. The blanket 'input.shift' early-return in installZoomShortcuts silently swallowed keyboard zoom-in on macOS: the chord matched neither branch and fell through to nothing. Shift is now evaluated per-chord: zoom-in accepts it, zoom-reset and zoom-out still reject it (Ctrl/Cmd+Shift+0 and Shift+'-' are different chords).
This commit is contained in:
parent
d8fd45e9a8
commit
bf39103087
1 changed files with 13 additions and 1 deletions
|
|
@ -4967,19 +4967,31 @@ function installZoomShortcuts(window) {
|
|||
window.webContents.on('before-input-event', (event, input) => {
|
||||
const mod = IS_MAC ? input.meta : input.control
|
||||
|
||||
if (!mod || input.alt || input.shift) {
|
||||
if (!mod || input.alt) {
|
||||
return
|
||||
}
|
||||
|
||||
const key = input.key
|
||||
|
||||
if (key === '0') {
|
||||
if (input.shift) {
|
||||
return // Ctrl/Cmd+Shift+0 is not a zoom chord — leave it alone
|
||||
}
|
||||
|
||||
event.preventDefault()
|
||||
setAndPersistZoomLevel(window, 0)
|
||||
} else if (key === '=' || key === '+') {
|
||||
// Zoom-in must accept the shift modifier: on US layouts Plus is
|
||||
// physically Shift+=, so Cmd+Plus arrives as Cmd+Shift+'+' (or '='
|
||||
// depending on platform). The old blanket shift guard silently
|
||||
// dropped keyboard zoom-in on macOS (#43517).
|
||||
event.preventDefault()
|
||||
setAndPersistZoomLevel(window, window.webContents.getZoomLevel() + ZOOM_STEP)
|
||||
} else if (key === '-') {
|
||||
if (input.shift) {
|
||||
return // Shift+'-' is '_' territory on most layouts, not zoom-out
|
||||
}
|
||||
|
||||
event.preventDefault()
|
||||
setAndPersistZoomLevel(window, window.webContents.getZoomLevel() - ZOOM_STEP)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue