mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-20 19:51:27 +00:00
Allow password field to be cleared with Ctrl/Command + backspace, implements #885.
This commit is contained in:
@@ -22,6 +22,8 @@ import javafx.scene.control.TextField;
|
||||
import javafx.scene.input.DragEvent;
|
||||
import javafx.scene.input.Dragboard;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyCodeCombination;
|
||||
import javafx.scene.input.KeyCombination;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.input.TransferMode;
|
||||
|
||||
@@ -43,6 +45,7 @@ public class SecurePasswordField extends TextField {
|
||||
private static final int GROW_BUFFER_SIZE = 50;
|
||||
private static final String DEFAULT_PLACEHOLDER = "●";
|
||||
private static final String STYLE_CLASS = "secure-password-field";
|
||||
private static final KeyCodeCombination SHORTCUT_BACKSPACE = new KeyCodeCombination(KeyCode.BACK_SPACE, KeyCombination.SHORTCUT_DOWN);
|
||||
|
||||
private final String placeholderChar;
|
||||
private final BooleanProperty capsLocked = new SimpleBooleanProperty();
|
||||
@@ -100,6 +103,9 @@ public class SecurePasswordField extends TextField {
|
||||
if (e.getCode() == KeyCode.CAPS) {
|
||||
updateCapsLocked();
|
||||
}
|
||||
if (SHORTCUT_BACKSPACE.match(e)) {
|
||||
swipe();
|
||||
}
|
||||
}
|
||||
|
||||
private void revealPasswordChanged(@SuppressWarnings("unused") Observable observable) {
|
||||
|
||||
Reference in New Issue
Block a user