I spent a bit more time on this and it seems that Find in the Selection Only has some additional quirks.
1) EmEditor doesn’t update the search range when selecting a new one.
2) EmEditor collapses the selection when it contains only one character (found or not).
In the following examples the macro code is:
nFound = document.selection.Find("d", eeFindNext | eeFindReplaceSelOnly);
status = "nFound = " + nFound;
And the find dialogue settings are:
Example 1: EmEditor search range.
In the following example EmEditor incorrectly uses the previous search range when searching in a new search range.
1) Restart EmEditor
2) Select the left abcd.
3) Find d in the selection (dialogue or macro). → Selects the left d ✔
4) Select the right abcd.
5) Find d in the selection (dialogue or macro). → Selects the left d 🤔
→ EmEditor used the previous search range rather than the current one.
Example 2: EmEditor one character selection collapse.
1) Restart EmEditor
2) Select one character, e.g. d
3) Find d in the selection → the selection collapses 🤔 (inconsistent with point 5 below).
4) Restart EmEditor
5) Select two characters, e.g. cd
6) Find d in the selection → the selection does not collapse (my preferred behaviour).
Btw: When selecting cd and searching for cd, the selection also doesn’t collapse, which is the expected (and in my case preferred) behaviour.