esc works
This commit is contained in:
parent
34295c9313
commit
c2a5226c0c
@ -221,6 +221,7 @@ public class MainWindow extends JFrame {
|
||||
|
||||
commandLine = new JTextField();
|
||||
commandLine.setFont(new Font("Monospaced", Font.PLAIN, 12));
|
||||
commandLine.setFocusTraversalKeysEnabled(false);
|
||||
commandLine.addActionListener(e -> executeCommand(commandLine.getText()));
|
||||
|
||||
// Let the panels catch focus back if user presses ESC or TAB in command line
|
||||
@ -229,10 +230,10 @@ public class MainWindow extends JFrame {
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
|
||||
commandLine.setText("");
|
||||
activePanel.getFileTable().requestFocus();
|
||||
activePanel.getFileTable().requestFocusInWindow();
|
||||
e.consume();
|
||||
} else if (e.getKeyCode() == KeyEvent.VK_TAB) {
|
||||
activePanel.getFileTable().requestFocus();
|
||||
activePanel.getFileTable().requestFocusInWindow();
|
||||
e.consume();
|
||||
}
|
||||
}
|
||||
@ -559,10 +560,8 @@ public class MainWindow extends JFrame {
|
||||
// ESC - global escape to return focus to panels
|
||||
rootPane.registerKeyboardAction(e -> {
|
||||
if (activePanel != null) {
|
||||
// If it's the command line, clear it too (though it has its own listener)
|
||||
if (commandLine.hasFocus()) {
|
||||
commandLine.setText("");
|
||||
}
|
||||
// Always clear command line and return focus to panels
|
||||
commandLine.setText("");
|
||||
activePanel.getFileTable().requestFocusInWindow();
|
||||
}
|
||||
}, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
|
||||
@ -782,6 +781,7 @@ public class MainWindow extends JFrame {
|
||||
} else {
|
||||
commandLine.setText(current + toAdd);
|
||||
}
|
||||
commandLine.requestFocusInWindow();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user