0
Under review

Changes view: add option to prefer selecting whole word on double click (don't stop on underscore separator)

Hyper Sonic 2 years ago updated by Thomas Singer 2 weeks ago 7

In the code/diff view, I noticed that double click selects only a sub-word, stopping at underscore separator.

I often copy paste class and method names into my commit message from the diff view, so it would be convenient to copy full symbol names such as "_can_start_attack" instead of just a subword, on double-click. For now, I must manually highlight the full word.

For retrocompatibility, an option could be added to preserve the old behaviour (subword select on double-click), or switch to full word highlight.

The option could be placed in the global preferences and/or, for quick access, in the small Hamburger menu of the code/diff view.

GOOD, I'M SATISFIED
Satisfaction mark by Hyper Sonic 2 years ago

Related, there could be an option to navigate per full word instead of subword when using Ctrl+Left/Right in text fields such as the Commit message area

Wow, I'm using 22.1.4 now and it seems that double-click selects whole word!

I don't see an option to revert to partial world selection, but it's not issue for me personally as I only exclusively care about copying full symbols.

Can you confirm the behavior change is official? Then you can close the ticket.

EDIT: I also upgraded to Ubuntu 22.04 in the meantime. It's possible it affected selection if SmartGit is relying on OS-level text handling.

Completed

For the file compare control SmartGit considers letters, digits and _ as word character.

Reading https://smartgit.userecho.com/communities/1/topics/1562-word-navigation-ctrlleftright-do-not-stop-before-and-after-every-space I found out that the Preferences > Low-level properties > styledtext.useOwnWordBoundaryDetection = false will use the system default boundary detection, and not only affect ctrl+left/right navigation but also double click selection.

Therefore keeping it true will select snake_case_words indeed, but if you set it to false in order to avoid stopping at the left and right of every space during ctrl+left/right navigation, you will also detect boundaries at underscores, breaking highlight on double-click at underscores (at least in Ubuntu 22.04 x SmartGit 23.1.2).

So I'm still looking for an ideal solution.

Hello. I'm using 24.1.3 and am experiencing the same problem.

Up until SmartGit version 23.1, underscores were included in identifiers. Therefore, when I double-clicked on an identifier in the editor, it was selected as [snake_case].

However, in SmartGit version 24.1 and later, double-clicking on an identifier selects it as [snake]_case and does not recognize identifiers that contain underscores.

I would like to see this behavior reverted to its previous state.

Under review

I'm working on making this work syntax-based (e.g. to select the whole literal, identifier). This won't work for other parts, e.g. inside strings or comments.