Various fixes [stage]

This commit is contained in:
crschnick
2026-02-03 23:27:19 +00:00
parent 1ece6a3f81
commit f8f74fcaa7
12 changed files with 49 additions and 15 deletions
@@ -134,9 +134,7 @@ public class ListBoxViewComp<T> extends RegionBuilder<ScrollPane> {
// If one node within has focus and moves out of focus fast,
// the scrollbar will try to focus another one and move it into view
// This can result in flicker when scrolling fast enough
if (scroll.isFocusWithin()) {
scroll.requestFocus();
}
scroll.requestFocus();
dirty.set(true);
});
scroll.heightProperty().addListener((observable, oldValue, newValue) -> {
@@ -92,7 +92,12 @@ public abstract class StoreSectionBaseComp extends RegionBuilder<VBox> {
AtomicReference<HBox> built = new AtomicReference<>();
Consumer<Boolean> update = (visible) -> {
if (visible) {
if (root.getScene() == null || !root.isVisible()) {
// Ignore any changes before this was added to the scene
if (root.getScene() == null && built.get() == null) {
return;
}
if (!root.isVisible()) {
return;
}
@@ -82,8 +82,9 @@ public class StoreViewState {
@Getter
private final ObservableValue<Comparator<StoreSection>> effectiveSortMode = Bindings.createObjectBinding(
() -> {
var g = globalSortMode.getValue() != null ? globalSortMode.getValue() : null;
var t = tieSortMode.getValue() != null ? tieSortMode.getValue() : StoreSectionSortMode.DATE_DESC;
var global = globalSortMode.getValue() != null ? globalSortMode.getValue() : null;
var tie = tieSortMode.getValue() != null ? tieSortMode.getValue() : StoreSectionSortMode.DATE_DESC;
var fallback = Comparator.<StoreSection, String>comparing(sec -> sec.getWrapper().getName().getValue());
var failed = Comparator.<StoreSection>comparingInt(value -> {
if (value.getWrapper().getValidity().getValue() == DataStoreEntry.Validity.LOAD_FAILED) {
return 1;
@@ -91,9 +92,9 @@ public class StoreViewState {
return 0;
});
return g != null
? failed.thenComparing(g.comparator().thenComparing(t.comparator()))
: failed.thenComparing(t.comparator());
return global != null
? failed.thenComparing(global.comparator().thenComparing(tie.comparator())).thenComparing(fallback)
: failed.thenComparing(tie.comparator()).thenComparing(fallback);
},
globalSortMode,
tieSortMode);
@@ -61,7 +61,7 @@ public class ShellDialects {
return d == POWERSHELL || d == POWERSHELL_CORE;
}
public static Optional<ShellDialect> byNameIfPresent(String name) {
public static Optional<ShellDialect> byIdIfPresent(String name) {
return ALL.stream().filter(shellType -> shellType.getId().equals(name)).findFirst();
}
@@ -32,6 +32,10 @@ public class ShellView {
return shellControl.getShellDialect();
}
public synchronized void setCachedPredicate(String key, boolean value) {
genericCache.put(key, value);
}
public synchronized boolean getCachedPredicate(String key, FailableSupplier<Boolean> supplier) throws Exception {
var v = genericCache.get(key);
if (v != null) {
@@ -948,6 +948,13 @@ public abstract class DataStorage {
for (DataStoreEntry e : toAdd) {
e.refreshStore();
}
// Retain ordering
toAdd.reversed().forEach(e -> {
ThreadHelper.sleep(1);
e.notifyUpdate(false, true);
});
this.listeners.forEach(l -> l.onStoreAdd(toAdd.toArray(DataStoreEntry[]::new)));
saveAsync();
}
@@ -175,6 +175,11 @@ public class DataStoreCategory extends StorageElement {
return true;
}
@Override
public boolean isInStorage() {
return DataStorage.get().getStoreCategories().contains(this);
}
@Override
public Path[] getShareableFiles() {
return new Path[] {directory.resolve("category.json")};
@@ -525,6 +525,11 @@ public class DataStoreEntry extends StorageElement {
}
}
@Override
public boolean isInStorage() {
return DataStorage.get().getStoreEntries().contains(this);
}
@Override
public Path[] getShareableFiles() {
var notes = directory.resolve("notes.md");
@@ -85,10 +85,15 @@ public abstract class StorageElement {
synchronized (listeners) {
listeners.forEach(l -> l.onUpdate());
}
// Save changes instantly
DataStorage.get().saveAsync();
if (isInStorage()) {
DataStorage.get().saveAsync();
}
}
public abstract boolean isInStorage();
public abstract Path[] getShareableFiles();
public void notifyUpdate(boolean used, boolean modified) {
@@ -105,7 +110,7 @@ public abstract class StorageElement {
}
// Save changes instantly
if (modified) {
if (modified && isInStorage()) {
DataStorage.get().saveAsync();
}
}
@@ -210,10 +210,10 @@ public class AppJacksonModule extends SimpleModule {
if (t == null) {
return null;
}
return ShellDialects.byNameIfPresent(t.asText()).orElse(null);
return ShellDialects.byIdIfPresent(t.asText()).orElse(null);
}
return ShellDialects.byNameIfPresent(tree.asText()).orElse(null);
return ShellDialects.byIdIfPresent(tree.asText()).orElse(null);
}
}
+4
View File
@@ -1615,6 +1615,10 @@ gitRepoDontWarn=Don't warn anymore
gitRepoDontWarnDescription=If this is expected, make XPipe ignore this error in the future
gitRepoTryAgain=Try again
gitRepoTryAgainDescription=Attempt the same operation again
gitRepoEnablePlain=Use plain directory sync
gitRepoEnablePlainDescription=Don't initialize a git repository to sync changes to directory
gitRepoCreateBare=Use git sync
gitRepoCreateBareDescription=Initialize a new bare git repository in the sync directory
gitRepoDisable=Disable git vault for now
gitRepoDisableDescription=Don't commit any changes during this session
gitRepoPullRefresh=Pull changes and refresh
+1 -1
View File
@@ -1 +1 @@
21.0-9
21.0-10