Browser fixes

This commit is contained in:
crschnick 2024-07-25 03:43:18 +00:00
parent dc93536be9
commit f15391a1a7
2 changed files with 18 additions and 11 deletions

View file

@ -147,15 +147,16 @@ public final class BrowserFileListComp extends SimpleComp {
}
var inCooldown = Duration.between(lastFail.get(), Instant.now()).toMillis() < 1000;
if (inCooldown) {
lastFail.set(Instant.now());
event.consume();
return;
} else {
lastFail.set(null);
typedSelection.set("");
table.getSelectionModel().clearSelection();
event.consume();
return;
}
lastFail.set(null);
typedSelection.set("");
table.getSelectionModel().clearSelection();
event.consume();
return;
}
lastFail.set(null);
@ -165,9 +166,15 @@ public final class BrowserFileListComp extends SimpleComp {
event.consume();
});
table.addEventFilter(MouseEvent.MOUSE_PRESSED, event -> {
typedSelection.set("");
lastFail.set(null);
});
table.addEventFilter(KeyEvent.KEY_PRESSED,event -> {
if (event.getCode() == KeyCode.ESCAPE) {
typedSelection.set("");
lastFail.set(null);
}
});
}

View file

@ -43,12 +43,12 @@ public class BrowserFileListCompEntry {
}
public void onMouseClick(MouseEvent t) {
if (showContextMenu(t)) {
if (lastContextMenu != null) {
lastContextMenu.hide();
lastContextMenu = null;
}
if (lastContextMenu != null) {
lastContextMenu.hide();
lastContextMenu = null;
}
if (showContextMenu(t)) {
var cm = new BrowserContextMenu(model.getFileSystemModel(), item, false);
cm.show(row, t.getScreenX(), t.getScreenY());
lastContextMenu = cm;