-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Script editor keyboard shortcuts not working on Mac (increase/decrease font size, block comment) #20
Comments
@GenevieveBuckley I notice all the shortcuts that don't work for you are symbols rather than letters. What kind of keyboard layout do you use? Are |
@ctrueden Yes,, the This list doesn't specifically call out an 'Australian' layout, but it looks as though I have what it's calling an "English" layout (not "English - Great Britain" or "English - International"). |
Thanks @GenevieveBuckley, that layout is identical to the one on my MacBook Pro. On my system, ⌘+ requires that shift also be pressed, since + is really just shift+=. The ⌘- shortcut works for me in all cases. The ⌘/ shortcut only works if you have a language selected from the Language menu; otherwise, it does not know which comment style to use. With the above comments in mind, given the high level of detail on your bug report, I'm going to proceed under the assumption that your system is different and indeed none of the three shortcuts are working for you whatsoever. I tried creating an MCVE. Here is a Java class we can use as a playground: import java.awt.BorderLayout;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import javax.swing.*;
public class ShortcutSandbox {
public static void main(final String... args) { new ShortcutSandbox(); }
private JMenu shortcuts;
private JLabel text;
public ShortcutSandbox() {
final int modifierCode = InputEvent.META_DOWN_MASK;
System.setProperty("apple.laf.useScreenMenuBar", "true");
JFrame frame = new JFrame("Keyboard Shortcut Test");
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
JPanel pane = new JPanel();
pane.setLayout(new BorderLayout());
text = new JLabel("[Try some menu entries]");
pane.add(text, BorderLayout.CENTER);
frame.setContentPane(pane);
JMenuBar menubar = new JMenuBar();
frame.setJMenuBar(menubar);
shortcuts = new JMenu("Shortcuts");
menubar.add(shortcuts);
createShortcut("Tee", KeyStroke.getKeyStroke(KeyEvent.VK_T, modifierCode));
createShortcut("Zero", KeyStroke.getKeyStroke(KeyEvent.VK_0, modifierCode));
createShortcut("Plus", KeyStroke.getKeyStroke(KeyEvent.VK_PLUS, modifierCode));
createShortcut("Minus", KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, modifierCode));
createShortcut("Slash", KeyStroke.getKeyStroke(KeyEvent.VK_SLASH, modifierCode));
createShortcut("Shift+Equals",
KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, modifierCode | InputEvent.SHIFT_DOWN_MASK));
frame.pack();
frame.setVisible(true);
}
private JMenuItem createShortcut(String label, KeyStroke accelerator) {
JMenuItem item = new JMenuItem(label);
item.setAccelerator(accelerator);
shortcuts.add(item);
item.addActionListener(evt -> text.setText(label));
return item;
}
} It should be possible to compile and run this on the command line with:
On my system, all keyboard shortcuts except for ⌘+ work. (If you comment out the "Shift+Equals" shortcut, then ⌘+ does still flash the menu when shift is included in the combo, but does not trigger the corresponding action.) In the script-editor source code in I don't have more time to dig on this right now, but please ping back here if you uncover any further information, workarounds, thoughts, etc. |
This is too generous :) Turns out this is true only for some shortcuts, and only for a specific set of circumstances. The ⌘/ shortcut⌘/ does not work for me if the language selected is:
It does work well for Beanshell, Clojure, Groovy, Java, JavaScript, Ruby, and Scala. The ⌘+ and ⌘- shortcuts
This totally fooled me - since the terminal, TextEdit, Atom, etc. also have ⌘+ listed in their menus as the shortcut for increasing text size (just like the script editor), and do not require you to press shift... I didn't even consider that. ⌘++ does not increase font size, but
Me too. ShortcutSandbox playgroundFrom the keyboard: ⌘T registers 'Tee', as expected.
This is completely fine, I'd say it's a fairly low priority. |
There's a subset of keyboard shortcuts for the Fiji script editor that I can't get working. I'm sure this is a non-exhaustive list, but the biggest annoyances are:
I can use these shortcuts with no trouble:
System details:
Mac High Sierra, 10.13.5
Fiji version: 2.0.0-rc-67/1.52d
Build 1762a07c5c
Date: 2018-06-04T18:22:47+0000
$ java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
The text was updated successfully, but these errors were encountered: