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

Caret position not updated on toggle comment in shader editor #25780

Closed
hsandt opened this issue Feb 10, 2019 · 0 comments · Fixed by #25782
Closed

Caret position not updated on toggle comment in shader editor #25780

hsandt opened this issue Feb 10, 2019 · 0 comments · Fixed by #25782

Comments

@hsandt
Copy link
Contributor

hsandt commented Feb 10, 2019

Godot version:
v3.0.6

OS/device including version:
Linux Ubuntu 18.04 (not relevant)

Issue description:
In the Shader Editor, toggling comment (context menu or default Ctrl+K) will not move the caret position accordingly, as it would in the Script Editor. It just stays in place, and is clamped to the end of the line if it goes beyond it. Since the line itself is prepended with "//", or "//" are removed from the beginning, the caret moves relatively to the line content.

Steps to reproduce:
1a. Create new Sprite, go to Material > New Material > click on material > Shader > New Shader > click on shader
1b. Alternatively, create a test.shader file in the project folder from your system, and open it in Godot
2. Enter "12345"
3. Move caret just after "3"
4. Toggle comment on this line to prepend with "//"

Expected:
Caret should remain just after "3"

Actual:
Caret stays on same position on-screen, therefore is moved to position just after "1"

This is also true when uncommenting via toggle.

My fix is ready, I will send a PR soon.

Related issues:
#12842 - 16 Oct 2017 (the commit that introduced toggle comment to the Shader Editor, unfortunately as a copy-paste, splitting the codebase for code actions in 2)
#22738 - 14 Nov 2018 (the commit that added caret position update for the Script Editor, but not the Shader Editor because of the split)
#22177 (about toggle comment in indented context: the actual issue I intend to fix later, but this first PR allows me to factorize things between the Script Editor and the Shader Editor to make it easier to fix the indentation issue on both sides at once)

@Chaosus Chaosus changed the title [Bug] [Shader Editor] Caret position not updated on toggle comment Caret position not updated on toggle comment in shader editor Feb 11, 2019
@akien-mga akien-mga added enhancement and removed bug labels Feb 12, 2019
@akien-mga akien-mga added this to the 3.2 milestone Feb 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants