sublimehq / sublime_text

Issue tracker for Sublime Text
https://www.sublimetext.com
809 stars 39 forks source link

Multiple selection (Ctrl+D) for repeating symbols breaks #6080

Open chr-bakk opened 1 year ago

chr-bakk commented 1 year ago

Problem description

Using { "keys": ["ctrl+d"], "command": "find_under_expand" }, breaks for selections of repeating characters.

Example from picture: I'm trying to select all instances of 2 tabs, but when I hit 3 tabs, selection breaks.

Example 2: I sometimes select three repeating line-endings, and use Ctrl+D to make multiple selections, but when I find a place with four line-endings the selecting breaks and any further use of Ctrl+D does not work.

Example 3: Instead of using the "convert indentations to tabs" I have to convert them manually (it doesn't always work if the spaces are another length than I'm using). Again when I select 4 spaces and keep adding selections of 5 or more spaces the selection breaks and stops working.

Preferred solution

I understand that there can be situations where you could want different behaviors'.

A solution is to select from the end of last instance thus making two new selections if the characters have twice the length as the string searched. A solution is to skip the entire longer instance and continue with the selections.

Alternatives

Make a warning that the selection could be found twice in the same sequence.

Additional Information

image

BenjaminSchaaf commented 1 year ago

When I make a with an empty line between the closing tab

I don't understand what this issue is about. It looks like something's missing in your report?

deathaxe commented 1 year ago

Just a shot into the darkness, but may it be related with or even be the same request as https://forum.sublimetext.com/t/rectangle-column-selection-using-the-keyboard/68880/6?

chr-bakk commented 1 year ago

When I make a with an empty line between the closing tab

I don't understand what this issue is about. It looks like something's missing in your report?

Yeah, I'm sorry, it was poorly written, it's better now.

deathaxe commented 1 year ago

I can reproduce the issue.

While hitting ctrl+d without any text selected expands selection to word boundaries, it should only find exact matches of already existing selections.

If 2 tabs (only whitespace) are selected, a following single tab (whitespace of shorter length) is added to the selection, causing the find pattern to be changed from 2 to 3. That's not correct.

Animation

Expected behavior would be to only find the first 2 tabs on each line in the show case.

Generally speaking only exactly 2 tabs should be added to selection and the original find pattern should keep unchanged (2 tabs).