nathanhoad / godot_dialogue_manager

A powerful nonlinear dialogue system for Godot
MIT License
2.04k stars 161 forks source link

GDScript failed to parse code_edit.gd because of new Godot 4.3 multicaret editing feature #588

Closed ProFiLeR4100 closed 2 months ago

ProFiLeR4100 commented 2 months ago

Describe the bug

CodeEdit class has changed signature of insert_text function in godot 4.3 in order to support multiple carret editing feature.

Affected version

To Reproduce

Steps to reproduce the behavior:

Expected behavior

Well, I expect it not to crash :smile:

Workaround (patch)

I changed the signature to be similar to the parent's. Not sure what the purpose of new parameters, but multicarret editing is working even with old function body.

Index: addons/dialogue_manager/components/code_edit.gd
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/addons/dialogue_manager/components/code_edit.gd b/addons/dialogue_manager/components/code_edit.gd
--- a/addons/dialogue_manager/components/code_edit.gd   (revision 9c68242a0f9dfc747692e609ec953d5ef9e238de)
+++ b/addons/dialogue_manager/components/code_edit.gd   (date 1717929925474)
@@ -276,7 +276,7 @@

 # Insert text at current caret position
 # Move Caret down 1 line if not => END
-func insert_text(text: String) -> void:
+func insert_text(text: String, p_line: int, p_column: int, p_before_selection_begin: bool = true, p_before_selection_end: bool = false) -> void:
    if text != "=> END":
        insert_text_at_caret(text+"\n")
        set_caret_line(get_caret_line()+1)
xchrix commented 2 months ago

I suffer this bug if I use the addon from assertlib, but if I use the addon from the git repo, the bug disappear.

Version with bug:

Version without bug:

ProFiLeR4100 commented 2 months ago

@xchrix Looks like you are correct. Version from GitHub uses insert_text_at_cursor and version from AssetLib uses insert_text image

ProFiLeR4100 commented 2 months ago

First I've thought that Nathan is overriding base method, but looks like it was the opposite.

So basically @nathanhoad need to deploy new release to AssetLib in order to fix this issue, because actual fix is already provided in next commit.