Sublime Forum

How Does Selection Work On Sublime?

#1

There are times when I select some text with a mouse, and it highlights all instances of the text as expected, e.g. in this c code, a mouse click selection on r gives:

struct record make_record(int id, char *name)
{
	struct record r; <-- Selection
                      ^
	r.id = id; 
        ^
	r.name = name;
        ^
	return r;
               ^
}

As expected, but selecting using ^D or alt+f3 result in selecting all instances of r. I’ve tried to search for what this
behaviour is called but cannot find anything. Any ideas? How would you get the “pre-selected” text to be selected?

0 Likes

#2

There’s a difference (intentional I believe) between Ctrl+D when there is no selection and when there is. Until I found out that there is a difference I just found the behaviour confusing, but after I found out I started using it in both ways more and more (this time on purpose).

If you select one or more characters and then Ctrl+D, it will select any matches of the same characters whether they are words or parts of words. If you put your text cursor on a word (and not select it) and then Ctrl+D, it will do word-based selection.

Ref:

2 Likes

#3

Thanks mate, this is the answer I’ve been looking for.

0 Likes