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

Minor usability issue with triple quotes #41361

Closed
danielzting opened this issue Aug 18, 2020 · 6 comments · Fixed by #50122
Closed

Minor usability issue with triple quotes #41361

danielzting opened this issue Aug 18, 2020 · 6 comments · Fixed by #50122

Comments

@danielzting
Copy link
Contributor

Godot version:

v3.2.2.stable.official

OS/device including version:

MacBookAir8,1
macOS Catalina 10.15.5 (19F101)

Issue description:

When I type three quotes in a row for a multiline comment or string, the script editor shouldn't automatically close the last one.

Steps to reproduce:
Type three quotes in any script

Minimal reproduction project:

@amoriqbal
Copy link
Contributor

I am attempting to fix the issue.

Present scenerio:

In the file scene / gui / text_edit.cpp
TextEdit :: consume_pair_symbol (CharType ch) is responsible for closing the quotes, braces, etc while typing, and also for putting braces, quotes, etc around selected texts. When the user inputs a quote or a brace, this function accepts that single char as a 'symbol'. It then decides whether to automatically insert its 'closing symbol' (eg. if user_input is [, then insert ]). This function does not look for """ (multiple chars). It closes single char opening symbols with single char closing symbols.

My approach:

When the function gets " it looks for """ (and corner cases). If found, it inserts """ as the closing symbol. This part is working.

The problem:

When we put braces around a selection, the function deselects the text after putting the braces in place. So, if we want to put """ before and after a piece of text, we need to select the text 3 times, putting one pair of braces each time. This does not seem user-friendly.
Please suggest something.
Thank You!

@amoriqbal
Copy link
Contributor

One approach is to remove the deselect() command at the end of the consume_pair_symbol() function. This will keep the text selected even after we have put one pair of braces or quotes around it. This will also be useful when we want to put the text inside multiple enclosures like ( ' <text> ' ).

@danielzting
Copy link
Contributor Author

If you've got the bug fixed that's good enough for a pull request IMO. What I usually end up doing is manually typing three quotes before and after the block. Though your addition is even better and matches what happens in VSCode. Currently though it only works if you use (. It would be even cooler if using ) would surround the selection with parentheses and a space like in surround.vim.

@amoriqbal
Copy link
Contributor

#41434
Check this out please.
Tell me if the changes need changing.

amoriqbal added a commit to amoriqbal/godot that referenced this issue Aug 21, 2020
Auto-completion triple-quotes
amoriqbal added a commit to amoriqbal/godot that referenced this issue Aug 21, 2020
	modified:   scene/gui/text_edit.cpp
	modified:   scene/gui/text_edit.h
amoriqbal added a commit to amoriqbal/godot that referenced this issue Aug 21, 2020
@goatchurchprime
Copy link

Another problem with the triple quote system is that the editor de-colours text that happens to be enclosed in a single quote within the multi-line string, which makes it appear to programmers familiar with the Python feature that GDScript does not have this multi-string capability.
image

It's also seems unnecessary that only the speech quote (") can be tripled up for the multiline string delimiter, but not the apostrophe quote (') as is allowed in Python.

amoriqbal added a commit to amoriqbal/godot that referenced this issue Oct 21, 2020
Apply suggestions from code review: Comment structure

Co-authored-by: Aaron Franke <arnfranke@yahoo.com>

reformat
@amoriqbal
Copy link
Contributor

Another problem with the triple quote system is that the editor de-colours text that happens to be enclosed in a single quote within the multi-line string, which makes it appear to programmers familiar with the Python feature that GDScript does not have this multi-string capability.
image

It's also seems unnecessary that only the speech quote (") can be tripled up for the multiline string delimiter, but not the apostrophe quote (') as is allowed in Python.

Please open a separate issue for this. The PR I made, does not handle this issue. That PR should close this issue. Make sure your bug-report does not get lost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants