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

Split script navigation state and edit state #66300

Merged
merged 1 commit into from
Oct 5, 2022

Conversation

KoBeWi
Copy link
Member

@KoBeWi KoBeWi commented Sep 23, 2022

Right now when you move in script editor history, the editor will store everything, including bookmarks, breakpoints and current highlighter. This actually leads to some bugs, e.g. old bookmarks can be restored if you go back to previous script.

This PR adds a navigation state, which is a subset of script edit state. Script editor history will use it instead.

Helps #63515

@KoBeWi KoBeWi added this to the 4.0 milestone Sep 23, 2022
@KoBeWi KoBeWi requested a review from a team as a code owner September 23, 2022 12:52
Copy link
Member

@Paulb23 Paulb23 left a comment

Choose a reason for hiding this comment

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

Not a fan of duplicating this code.

Could we get rid of set_navigation_state and use set_edit_state. Then make get_edit_state use get_navigation_state.

Comment on lines -3388 to +3393
if (Object::cast_to<ScriptEditorBase>(n)) {
Object::cast_to<ScriptEditorBase>(n)->set_edit_state(history[history_pos].state);
Object::cast_to<ScriptEditorBase>(n)->ensure_focus();
ScriptEditorBase *seb = Object::cast_to<ScriptEditorBase>(n);
if (seb) {
seb->set_edit_state(history[history_pos].state);
seb->ensure_focus();

Ref<Script> script = Object::cast_to<ScriptEditorBase>(n)->get_edited_resource();
Ref<Script> script = seb->get_edited_resource();
Copy link
Member Author

Choose a reason for hiding this comment

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

This is not necessary after removal of set_navigation_state(), but it's probably a nice refactor.

@akien-mga akien-mga merged commit 121e1df into godotengine:master Oct 5, 2022
@akien-mga
Copy link
Member

Thanks!

@KoBeWi KoBeWi deleted the 📝🧭 branch October 5, 2022 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants