diff --git a/ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controller/DebuggerMain.java b/ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controller/DebuggerMain.java index c815acc187c8aaa8a52892f9a83aac1884e2ed9a..dc56e256bea67b3ef2de0032aa35265d44ff7af9 100644 --- a/ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controller/DebuggerMain.java +++ b/ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controller/DebuggerMain.java @@ -66,6 +66,7 @@ import org.reactfx.util.Timer; import javax.annotation.Nullable; import javax.swing.*; +import java.awt.im.InputContext; import java.io.File; import java.io.FileWriter; import java.io.IOException; @@ -277,6 +278,7 @@ public class DebuggerMain implements Initializable { ImmutableList openGoals = p.getSubtreeGoals(p.root()); KeyData kd = new KeyData(openGoals.get(0), env, p); scriptController.getAutoCompleter().getArgumentCompleter().setDefaultKeyData(kd); + }; getFacade().environmentProperty().addListener(invalidationListener); getFacade().proofProperty().addListener(invalidationListener); @@ -676,8 +678,8 @@ public class DebuggerMain implements Initializable { private void onInterpreterError(DebuggerFramework keyDataDebuggerFramework, Throwable throwable) { Platform.runLater(() -> { - Utils.showExceptionDialog("Error during Execution", "Error during Script Execution", - "Here should be some really good text...\nNothing will be the same. Everything broken.", + Utils.showExceptionDialog("An error has occurred during execution.", "Error during Script Execution", + "Please reload the problem to get a consistent proof state.", throwable ); }); diff --git a/ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/ScriptArea.java b/ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/ScriptArea.java index 88c06351c9ba205ff4d591384818264e7858767d..fcfd74225bbd2ab659e8b1190d80044e5ee75c05 100644 --- a/ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/ScriptArea.java +++ b/ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/ScriptArea.java @@ -34,6 +34,7 @@ import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.control.*; import javafx.scene.input.*; +import static javafx.scene.input.KeyCombination.CONTROL_ANY; import javafx.scene.layout.*; import javafx.scene.paint.Color; import javafx.scene.paint.Paint; @@ -141,6 +142,7 @@ public class ScriptArea extends BorderPane { private void init() { codeArea.setAutoScrollOnDragDesired(false); + InputMap inputMap = sequence( process(EventPattern.keyPressed(), (e) -> { @@ -148,6 +150,8 @@ public class ScriptArea extends BorderPane { inlineToolbar.hide(); return PROCEED; }), + consume(keyPressed(new KeyCodeCombination(KeyCode.E, KeyCombination.CONTROL_DOWN)) + , (e) -> addBackticks()), consumeWhen(keyPressed(KeyCode.ENTER), autoCompletion::isVisible, e -> autoCompletion.complete()), consume(keyPressed(KeyCode.ENTER, SHORTCUT_DOWN), @@ -241,6 +245,7 @@ public class ScriptArea extends BorderPane { //this.moveTo(characterPosition, NavigationActions.SelectionPolicy.CLEAR); }); + mainScript.addListener((observable) -> updateMainScriptMarker()); filePath.addListener((p, o, n) -> { if (o != null) @@ -357,6 +362,14 @@ public class ScriptArea extends BorderPane { } + private void addBackticks(){ + int pos = codeArea.getCaretPosition(); + insertText(pos, "``"); + codeArea.displaceCaret(pos+1); + + + + } private void highlightProblems() { LinterStrategy ls = LinterStrategy.getDefaultLinter(); try {