flandreas / antares

Digital circuit learning platform
49 stars 6 forks source link

Keyboard component crashes if rich text markers are used #725

Closed fpw closed 6 months ago

fpw commented 6 months ago

When using the builtin keyboard component, entering a "!" character triggers this error because the internal label wants to render it as rich text, expecting something to follow after the "!".

Also, pressing space triggers simulation pause for me, I think hotkeys should not take affect if the keyboard has focus.

Version: 1.12.0
Using workspace C:\Users\rmein\AppData\Roaming\Antares
Close SideBarPane 'null'
Open SideBarPane 'Explorer'
Open main Library/Project 'PDP-8/I'
Open application data
Enter execution mode (deep = true)
Descending into SubGraphVerticeView
java.lang.NullPointerException: null cannot be cast to non-null type kotlin.String
    at ch.scorpion.jabbah.base.richtext.RichTextParser.text(RichTextParser.kt:235)
    at ch.scorpion.jabbah.base.richtext.RichTextParser.singleChar(RichTextParser.kt:242)
    at ch.scorpion.jabbah.base.richtext.RichTextParser.overline(RichTextParser.kt:226)
    at ch.scorpion.jabbah.base.richtext.RichTextParser.styledChunk(RichTextParser.kt:182)
    at ch.scorpion.jabbah.base.richtext.RichTextParser.fragment(RichTextParser.kt:114)
    at ch.scorpion.jabbah.base.richtext.RichTextParser.styledFragment(RichTextParser.kt:92)
    at ch.scorpion.jabbah.base.richtext.RichTextParser.richText(RichTextParser.kt:82)
    at ch.scorpion.jabbah.base.richtext.RichTextParser.parse(RichTextParser.kt:76)
    at ch.scorpion.jabbah.draw.drawable.RichTextDrawable$Companion.of(RichTextDrawable.kt:54)
    at ch.scorpion.jabbah.draw.drawable.RichTextDrawable$Companion.of$default(RichTextDrawable.kt:52)
    at ch.scorpion.jabbah.edit.model.text.Label.setText(Label.kt:56)
    at ch.scorpion.antares.view.input.KeyboardView.handleStateChanged(KeyboardView.kt:141)
    at ch.scorpion.jabbah.graph.view.AbstractGraphElementView$ModelListener.stateChanged(AbstractGraphElementView.kt:139)
    at ch.scorpion.jabbah.graph.model.element.AbstractGraphElement.stateChanged(AbstractGraphElement.kt:100)
    at ch.scorpion.jabbah.graph.model.element.AbstractGraphElement.stateChanged$default(AbstractGraphElement.kt:97)
    at ch.scorpion.antares.model.input.Keyboard.enter(Keyboard.kt:137)
    at ch.scorpion.antares.view.input.KeyboardView$InteractionHandler.keyPressed(KeyboardView.kt:271)
    at ch.scorpion.antares.view.input.KeyboardView$InteractionHandler.keyPressed(KeyboardView.kt:260)
    at ch.scorpion.jabbah.graph.ui.GraphViewExecutionHandler$KeyHandler.keyPressed(GraphViewExecutionHandler.kt:196)
    at ch.scorpion.jabbah.draw.view.KeyEventBridge.keyPressed(CanvasJvm.kt:323)
    at java.desktop/java.awt.AWTEventMulticaster.keyPressed(AWTEventMulticaster.java:258)
    at java.desktop/java.awt.Component.processKeyEvent(Component.java:6575)