godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
84.58k stars 18.55k forks source link

Selecting words in the code editor treats backticks different from other similar punctuation. #91565

Open skysphr opened 2 weeks ago

skysphr commented 2 weeks ago

Tested versions

4.2.stable

System information

Godot v4.2.2.rc (2dab9dc55) - Arch Linux #1 SMP PREEMPT_DYNAMIC Thu, 29 Feb 2024 19:08:51 +0000 - Wayland - Vulkan (Mobile) - dedicated AMD Radeon RX 580 Series (RADV POLARIS10) () - AMD Ryzen 7 2700 Eight-Core Processor (16 Threads)

Issue description

In the following code

var string1 = "|word1| `word2` 'word3'"
var string2 = '[word1] `word2` "word3"'

everything behaves as expected except for word2 on both lines. When selecting it via double click or via Ctrl+left arrow, the selection will include the left backtick. Selecting via Ctrl+right arrow works fine. Interestingly, if you remove the quotes and let the backticks roam free in the editor (not that it would make any sense doing that as it is not valid syntax), they are both treated as alphanumerics, getting selected together with the rest of the word.

Now I agree this is a minor annoyance and probably irrelevant for 99.9% of users, but maybe 3 years from now someone (or me) will be bored and decide to fix this random bug.

Steps to reproduce

Paste the above snippet in Godot's code editor and try selecting stuff with double click and Ctrl+arrows.

Minimal reproduction project (MRP)

N/A

AThousandShips commented 2 weeks ago

Backtick isn't punctuation or an operator in GDScript so I'd expect this to treat it as part of the word

wyattbiker commented 6 days ago

Is it related to Double clicking on a word can select prior not character symbol #69254