sublime_text
sublime_text copied to clipboard
You can not search backwards with the API
The Find panel defines a "Find Prev" Button, but this is not reflected in the API.
view.find(pattern, fromPosition, <flags>) does not provide a way to search backwards.
The only way to implement this now is by either substracting arbitrary numbers from fromPosition and trying as long as 0 is reached or a match before the initial fromPosition is found, or using view.find_all(pattern, <flags>, <format>, <extractions>) and then searching for the last find before fromPosition.
Initially brought up at http://www.sublimetext.com/forum/viewtopic.php?f=6&t=15300&p=57797#p57797.
Dear developer, please add a flag that would denote the search direction to "view.find" (as suggested here): it is trivial to implement, and it is being expected for at least 10 years.
Build 4149 adds FindFlags.WHOLEWORD, FindFlags.REVERSE and FindFlags.WRAP.