I think this is a bug unless I misunderstand the API:
When calling
view.show(placeToGo)
There is no refresh, as soon as you move the cursor or scroll the view (even a pixel) everything refreshes. The only workaround I’ve found is to set (scroll past the end) to true and manually scroll the view a little. Below is an example of the problem.
[code]import sublime_plugin
class NextInterestingThing(sublime_plugin.WindowCommand):
rex = ‘(^\ \t](class|def)\ \t]+\w+\ \t](.*$|(?!\w\W])|\Z|\n\n\w)’
def run(self):
view = self.window.active_view()
# get current line
curPoint = view.line(view.sel()[0].a).b
found = view.find(self.rex, curPoint)
placeToGo = view.line(found.b)
if placeToGo:
view.sel().clear()
view.sel().add(placeToGo)
view.show(placeToGo)
for delta in [1, -1]:
x, y = view.viewport_position()
view.set_viewport_position((x, y + delta))[/code]