Skip to content

web: pass Ctrl-= through to browser for font size increase#1713

Draft
Copilot wants to merge 2 commits intomasterfrom
copilot/fix-ctrl-plus-zoom
Draft

web: pass Ctrl-= through to browser for font size increase#1713
Copilot wants to merge 2 commits intomasterfrom
copilot/fix-ctrl-plus-zoom

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 3, 2026

Ctrl-= (the no-Shift convention for Ctrl-plus) was intercepted by SolveSpace's canvas zoom-in handler, blocking the browser from using it to increase font size. Ctrl-minus already passed through unblocked because the ZOOM_OUT accelerator is bound to bare - (no Ctrl), so the match failed and EM_FALSE was returned — but Ctrl-= had a special-case handler in GraphicsWindow::KeyboardEvent that matched regardless of Ctrl state.

Change

Added an early-exit in KeyboardCallback (guihtml.cpp) before any event processing:

// Pass Ctrl-= through to the browser (for font size increase), symmetric with
// Ctrl-minus which is already passed through since it doesn't match any shortcut.
if(emEvent->ctrlKey && strcmp(emEvent->key, "=") == 0) return EM_FALSE;

= without Ctrl continues to trigger canvas zoom-in as before.

Copilot AI linked an issue Apr 3, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix Ctrl-plus functionality for text zooming web: pass Ctrl-= through to browser for font size increase Apr 3, 2026
Copilot AI requested a review from phkahler April 3, 2026 17:44
@phkahler
Copy link
Copy Markdown
Member

phkahler commented Apr 3, 2026

@copilot Why do you think CTRL - works but CRTL = need this change?

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 3, 2026

@copilot Why do you think CTRL - works but CRTL = need this change?

The difference is in how each key is handled inside GraphicsWindow::KeyboardEvent:

Ctrl-minus: The ZOOM_OUT accelerator is bound to bare '-' (no Ctrl). When Ctrl-minus arrives, event.controlDown = true, so it doesn't match the accelerator (which expects controlDown = false). No handler claims it → KeyboardEvent returns falseKeyboardCallback returns EM_FALSE → browser sees it and decreases font size. ✓

Ctrl-=: There's a special-case handler at graphicswin.cpp:249 that matches event.chr == '=' without checking controlDown:

} else if(event.chr == '=') {
    // Treat = as +.
    MenuView(Command::ZOOM_IN);
    return true;
}

This fires for both bare = and Ctrl-=, returning true both times. So KeyboardCallback returns EM_TRUE → the browser never sees Ctrl-= → font size increase is blocked. ✗

The fix in guihtml.cpp short-circuits before the event even reaches GraphicsWindow::KeyboardEvent when Ctrl-= is pressed, letting the browser handle it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Blocks Ctrl-plus but not Ctrl-minus

2 participants