Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MarkdownComponent: NotImplementedError in certain edge cases with blank markdown #98

Open
DJtheRedstoner opened this issue Nov 18, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@DJtheRedstoner
Copy link
Member

DJtheRedstoner commented Nov 18, 2022

Describe the bug
In certain cases, the a MarkdownComponent can have 0 drawables, which causes a NotImplementedError here.

To Reproduce
Steps to reproduce the behavior:

  1. Apply this patch to ComponentsGui
@@ -267,7 +268,7 @@
         } childOf window
 
         ComponentType("Markdown") {
-            MarkdownComponent(
+            val c = MarkdownComponent(
                 """
                     # Markdown!
                     
@@ -283,6 +284,11 @@
                 width = 200.pixels()
                 height = 100.pixels()
             } childOf this
+
+            c.onMouseClick {
+                c.bindText(BasicState(""))
+            }
+
         } childOf window
 
         ComponentType("SVG") {
  1. Open the components gui
  2. Click on the current text of the markdown component, hold and drag to another location on the screen
  3. The gui crashes and a NotImplementedError is logged (example)

Expected behavior
The the markdown component becomes blank without crashing the gui.

Additional context
There are possibly other ways to trigger this issue, but this is the way I found. The root cause appears to be commonmark's parser not having any children nodes for a blank document, causing MarkdownRenderer to produce an empty drawable list

@DJtheRedstoner DJtheRedstoner added the bug Something isn't working label Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant