QoL: provide easy way to restart processor (#10743)

This commit is contained in:
Cardillan
2025-04-30 18:46:18 +02:00
committed by GitHub
parent b4068f2a74
commit 80047eb4db
2 changed files with 12 additions and 3 deletions

View File

@@ -31,7 +31,7 @@ public class LogicDialog extends BaseDialog{
boolean privileged;
@Nullable LExecutor executor;
GlobalVarsDialog globalsDialog = new GlobalVarsDialog();
boolean wasRows, wasPortrait;
boolean wasRows, wasPortrait, forceRestart;
public LogicDialog(){
super("logic");
@@ -142,7 +142,14 @@ public class LogicDialog extends BaseDialog{
}catch(Throwable e){
ui.showException(e);
}
}).marginLeft(12f).disabled(b -> Core.app.getClipboardText() == null);
}).marginLeft(12f).disabled(b -> Core.app.getClipboardText() == null).row();
t.button("@logic.restart", Icon.refresh, style, () -> {
forceRestart = true;
dialog.hide();
hide();
}).marginLeft(12f);
});
});
@@ -336,6 +343,7 @@ public class LogicDialog extends BaseDialog{
public void show(String code, LExecutor executor, boolean privileged, Cons<String> modified){
this.executor = executor;
this.privileged = privileged;
this.forceRestart = false;
canvas.statements.clearChildren();
canvas.rebuild();
canvas.privileged = privileged;
@@ -346,7 +354,7 @@ public class LogicDialog extends BaseDialog{
canvas.load("");
}
this.consumer = result -> {
if(!result.equals(code)){
if(forceRestart || !result.equals(code)){
modified.get(result);
}
};