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

View file

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