Skip to content

Commit 2988136

Browse files
committed
Added alternative key binding for "Increase Font Size"
This commits adds the "CTRL SHIFT =" as key to increase font size. The old shortcut "CTRL +" is still active, but it's not always possible to produce it if the keyboard layout doesn't have the + key on the base layer. This add the possibility to compose "CTRL +" when the keyboard has the "+" available as "SHIFT =", that seems to be very common in many layouts. Fix #6806
1 parent 1a576dd commit 2988136

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

Diff for: app/src/processing/app/Editor.java

+9-6
Original file line numberDiff line numberDiff line change
@@ -1397,12 +1397,15 @@ public void actionPerformed(ActionEvent e) {
13971397
JMenuItem increaseFontSizeItem = newJMenuItem(tr("Increase Font Size"), KeyEvent.VK_PLUS);
13981398
increaseFontSizeItem.addActionListener(event -> base.handleFontSizeChange(1));
13991399
menu.add(increaseFontSizeItem);
1400-
1401-
JMenuItem decreaseFontSizeItem = newJMenuItem(tr("Decrease Font Size"), '-');
1402-
decreaseFontSizeItem.addActionListener(new ActionListener() {
1403-
public void actionPerformed(ActionEvent e) {
1404-
base.handleFontSizeChange(-1);
1405-
}
1400+
// Add alternative shortcut "CTRL SHIFT =" for keyboards that haven't the "+" key
1401+
// in the base layer. This workaround covers all the keyboards that have the "+"
1402+
// key available as "SHIFT =" that seems to be very common.
1403+
KeyStroke ctrlShiftEq = KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, SHORTCUT_KEY_MASK | ActionEvent.SHIFT_MASK);
1404+
menu.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(ctrlShiftEq, "IncreaseFontSize");
1405+
menu.getActionMap().put("IncreaseFontSize", new AbstractAction() {
1406+
public void actionPerformed(ActionEvent e) {
1407+
base.handleFontSizeChange(1);
1408+
}
14061409
});
14071410
menu.add(decreaseFontSizeItem);
14081411

0 commit comments

Comments
 (0)