Sublime Forum

Alt+F3 (findallunder) behavior issue (bug?)

#1

I’m new to Sublime Text. I find findallunder’s behavior is strange hopefully someone can address this.

I use Alt+F3 (findallunder) to temporary highlight a keyword I interests (like “Mark all”) and it works as expected,
Latter, I want to un-mark the keyword, so I press “ESC” (it’s kind of nature to me to press ESC to cancel something),
then all marks disappears except the first one in this file (This is what ESC is defined in sublime text == single select mode).
At this stage, the cursor will jump to the place of the first apprerance of the keyword and this behavior
is so bothering me because the cursor should stay where it was before “Mark all” and “Un-mark all”.

Summaries:

  1. I expect the cursor should stay where it was when switching between “multi-select” an “single-select”
    Is it a bug?
  2. If it is by design, what is the usage case?
  3. I just can’t stop my finger to press the ESC key. :frowning: Is there an option to configure it?
  4. If I shouldn’t use “alt+f3” to do “mark all” and “un-mark all”, what is the best way to do this?
    I found a plugin “stickySearch” works, but I’m looking for other alternative because “stickySearch”
    gives me a better solution, but buggy.
0 Likes

#2

@sublimator
Thanks for your softundo hint. Its great!

I digged the forum and found this post: https://forum.sublimetext.com/t/soft-undo/307/1&hilit=softundo&sid=636f775f2457d624bf5f8a4896e93463&sid=823e59117130b85095734198a13df4bc#p2430
discussing softundo.
I have the same issue which softundo can’t remember the mouse click. :frowning:

“StickySearch” plugin is so far best suit my need. Its multiple “keywords” highlight support
is great, but cursor can only jump between the last keyword’s regionset.
The “API for multiple RegionSets” catch my eyes because I think my concerns
regarding to the “stickySearch” is caused by the lack of “multiple RegionSets” API support. (?)
Can’t the plugin implement the 'multiple regionSets" by itself? It is something like save
multiple RegionSet in a plugin’s context, right? Or the plugin system can’t have its own context?
(I’m new to the sublime text API. It may be a silly question…)

0 Likes

#3

softUndo should be working fine with mouse based selections since the 20091023 beta - what version of Sublime Text are you using?

The behaviour you’re seeing with Alt+F3 is a byproduct of the design: when there are multiple selections, they’re all treated as equal, so when running the singleSelection command, it simply removes all of the selections bar the first one. It’d likely make more sense for singleSelection to choose the first visible region, rather than just the first. It still wouldn’t necessarily be the selection you had before pressing Alt+F3 though.

You can configure the key bindings, take a look through Preferences/Default Key Bindings for the ‘singleSelection’ command.

0 Likes

#4

softUndo should be working fine with mouse based selections since the 20091023 beta - what version of Sublime Text are you using?

I’m using v1.3. I re-test this issue and I found this issue only applies to “alt+f3”, not all. Here is the step to reproduce:

  1. open a txt file. (I use the “Default File type.sublime-options”)
  2. Use mouse to move the cursor to a place. (Let’s call it place A)
  3. Use mouse to move the cursor to another place (place B) which has the keyword in interest.
  4. Press alt+f3. All the regions of this keyword will be highlighted as expected.
  5. Press ctrl-u. The highlighted regions will disappear, but the cursor will jump to place A, which is incorrect. I expect the cursor will jump to place B.

The behaviour you’re seeing with Alt+F3 is a byproduct of the design: when there are multiple selections, they’re all treated as equal, so when running the singleSelection command, it simply removes all of the selections bar the first one. It’d likely make more sense for singleSelection to choose the first visible region, rather than just the first. It still wouldn’t necessarily be the selection you had before pressing Alt+F3 though.

Here is what I (as a user) expected. For your reference. And hopefully you can find a solution making more sense. :smile:
From my usage point of view, singleSelection mode is only meanful when switching from multi-selection mode.
And I guess this is why singleSelection mode is default bind to “ESC” key.
IFF it is true that singleSelection is only used to switch multi-slection mode back to singleSelection mode,
then User will expect the cursor(forcus) should go back to the place where multi-selection mode begins.
Under alt+f3 case, the cursor is expected to be reverted to where the user pressed alt+f3 at beginning.
Under “ctrl+mouse_double_click multiple regions” case, the cursor is expected to be reverted to the beginning of first region switching
from singleSelect “mouse_double_click” to multi-select “ctrl+mouse_double_click”.
From my test, swiching back to singleSelection mode will always place the cursor(forcus) to the first region of the file.
From user’s point of view, the first region of the file has less meaning than the place where the multi-selection mode begins.
From my point of view, the first visible sigleSelection region also has less meaning than the place where the multi-selection mode begins.
Maybe other users can comment on their thought.

BTW, it will be great to have commands to jump cursor(forcus) back and forth.
Ctrl+u has similar function to jump cursor back, but ctrl+u is part of undo history and can not “redo”(jump forth).
It is something more lilke an “cursor forcus history”. With this feature, I can jump to a function B
define from palce A (using search or cTag or any methods which changing the cursor forcus)
and revert forcus back to place A after I finished my work in function B.
I can’t find a plugin or command for this feature. :frowning:
This feature is so helpful when tracing code.

0 Likes

#5

I’ll take a look at what’s going on with the combination mouse based selections, alt+f3 and softUndo.

re: single selection / multi selection, I can see what you’re getting at. Internally however, they’re not treated any different by Sublime, there’s no multi select mode as such, just a collection of selections, and if there’s only one of them, then so be it. I agree with you though, what you’re explaining would clearly be a better user experience in this case. It’s certainly possible to track extra state to nominate a selection as a ‘primary’ one, but it’s somewhat simpler to treat all regions equally.

re: ctrl+u and redo, there’s also the key binding ctrl+shift+u, ‘softRedo’, that will step in the other direction to softUndo.

0 Likes

#6

@jps
Thanks for your reply and accepts the single/multi-selection usage experience.
Hopefully, sublime text can get better and better.

As for “SoftRedo”, actually I tried it, but I can’t understand what’s going on when pressing “SoftRedo”.
It doesn’t re-do what was un-did?!. Is there any document/post explaining this?
Or it is a bug? (I’m using v1.3)

0 Likes

#7

That does indeed look like a bug, I’ll investigate it.

0 Likes