Skip to content

Updated split_code_edit.gd to be editable and sync changes - #166

Open
themipper wants to merge 2 commits into
Maran23:masterfrom
themipper:master
Open

Updated split_code_edit.gd to be editable and sync changes#166
themipper wants to merge 2 commits into
Maran23:masterfrom
themipper:master

Conversation

@themipper

Copy link
Copy Markdown

Made the split_code_edit.gd editable.
Changes are synced between source and split.
Scroll-position and caret-position are preserved.

…rce and split

The split edit is now editable and syncs changes between the original. If the original is closed the split is also closed.
@Maran23

Maran23 commented Aug 20, 2026

Copy link
Copy Markdown
Owner

When I type something in the split CodeEdit, the save indicator (*) does not appear. Not in the split button, but also not on the Tab.

Also when I close the Tab, the right side will be empty and still in split mode. This feels weird. I like the idea of the synchronization but it most be more user friendly IMO.

editable = true
caret_draw_when_editable_disabled = true
set_v_scroll.call_deferred(last_v_scroll)
set_v_scroll.call_deferred(last_v_scroll)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty space at the end

extends CodeEdit

var last_v_scroll: float
var pause_text_changed = false

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use types always. : bool

static func new_from(from_code_edit: CodeEdit) -> CodeEdit:
var new_code_edit: CodeEdit = new()

if not from_code_edit.tree_exiting.is_connected(new_code_edit.exit_tree.bind(new_code_edit)):

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the ! instead of not

to.scroll_vertical = scroll
pause_text_changed = false

func to_changed(from:CodeEdit,to:CodeEdit) -> void:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please always leave an empty space after the :, e.g. from: CodeEdit

@themipper

Copy link
Copy Markdown
Author

I will add the save indicator and close the split tab when the main file is closed.
Will be a couple of days since I find the time to look at implementing theses changes.
Thanks for reviewing.

@Maran23

Maran23 commented Aug 20, 2026

Copy link
Copy Markdown
Owner

I will add the save indicator and close the split tab when the main file is closed. Will be a couple of days since I find the time to look at implementing theses changes. Thanks for reviewing.

don't worry, take your time! If you are stuck, tell me, I may have a look as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants