Search Option: Selection Only (Block)

Click the Block button on the search toolbar to turn on the "selection only" search option to search only through the selected part of the current file.

If you turn on this option and invoke a search command such as Find First that processes only a single search match then the selection is turned into the search range. The search range highlight color is different from the selection highlight color. You can configure the "selected text" and "search range" colors in the Colors Preferences.

If a search match is found, that search match is selected. You can then edit the search match or any part of the file inside or outside the search range. As long as you don't turn off the "selection only" search option, the search range remains highlighted.

If no search match is found, the text that was selected does become the search range. But it also remains selected. So you won't see that it is the search range unless you change or clear the selection. The selection highlight goes on top of the search range highlight.

When you invoke the next search command, EditPad uses the existing search range if there is no selection or the selection falls entirely inside the search range. If the selection includes text outside the search range, then EditPad uses the selection as the new search range.

In practice, this mechanism is very intuitive. When you search, EditPad selects the search match, which always falls inside the search range. So you can click Search|Find Next and Search|Find Previous without paying much attention to the search range. It will stay put. When you want to search through a different part of the file, simply select it, make sure "selection only" is on, and search. You don't need to check whether there was a search range already. EditPad will search through the block of text that you selected.

Commands such as replace all that processes all search matches use the existing search range when there is no selection or the selection falls entirely within the existing search range. If the selection falls outside the search range, the search range is removed. If the search range is remove or there was no search range to begin with, then these commands perform their action (such as replacing all matches) within the selected text only, without turning that text into a search range. The text remains selected, regardless of whether any matches were found.

In the Search Preferences you can choose whether EditPad automatically turns the "selection only" on or off when you prepare to search. When this preference is on, preparing to search when there is a multi-line selection turns on "selection only". Preparing to search when there is no selection or a selection within a single line turns off "selection only". Preparing to search does not remove an existing search range. So you can turn the "selection only" option back on to keep using the exiting search range in case that option was turned off when preparing your next search.

If you manually turn off "selection only" then any existing search range is removed immediately.

See also

Search|Prepare to Search
Search Options
Search Preferences