Find flags (regex, case sensitive, etc) are now specified via the application options, which are accessible from python plugins via sublime.options(), eg., running sublime.options().set("find.regex", True) will turn regex mode on from a plugin.
Also now exposed to plugins is the ability to change the current search string (as shown in the find panel, and used by F3): overwrite the option "find.string" to change this.
The main new bit of functionality in this beta is an experimental API to add tracked regions to the view (say, what bookmarks do), which will be updated as the buffer is modified, and can optionally be drawn. The functions are likely to change, so I haven't added them to the API reference, but in brief:
- Code: Select all
view.addRegions(key, regions, scope)
eg., addRegions("findResults", [sublime.Region(0, 100), sublime.Region(150, 200)], "string")
The first argument, key, is a string used to retrieve the stored regions later. The second is simply the list of regions. The third argument is a scope name, which, if not blank, will be used to find the colors to draw the regions in.
getRegions can be used to retrieve previously set regions: this is handy if you're trying to track a position in the buffer, as the regions will be updated to maintain their position when the buffer is modified.
I'm keen for feedback on the API, and if it's sufficient for the plugins you want to write.