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

Feature/fix toggle comment indent #25782

Merged

Conversation

hsandt
Copy link
Contributor

@hsandt hsandt commented Feb 10, 2019

Fix #25780

The PR has 2 commits for 2 steps: refactor and fix.

Refactor step slightly changes the behaviour of toggle_comment in the Shader Editor, updating the caret position but by the wrong offset (hardcoded 1 instead of 2 since comment delimiter is "//").
Fix replaces the hardcoded 1 with delimiter length to make solution generic.

After discussion with @Paulb23, I decided to extract the toggle_inline_comment method in CodeTextEditor (child of ScriptTextEditor, and also the base class for ShaderTextEditor) rather than TextEdit (the actual part where you read and edit text). Technically it could be part of TextEdit, but the current convention seems to move higher-level text manipulation to the CodeTextEditor. On my next PR (for #22177), I will probably have a pass on the comment-related methods still in TextEdit.

…ng EDIT_TOGGLE_COMMENT case

CodeEditor::toggle_inline_comment is now used by both ScriptTextEditor and ShaderEditor
@akien-mga akien-mga merged commit e5a310c into godotengine:master Mar 16, 2019
@akien-mga
Copy link
Member

Thanks!

@hpvb
Copy link
Member

hpvb commented Apr 20, 2019

Let's consider for 3.1.2

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.

Caret position not updated on toggle comment in shader editor
5 participants