Sublime Forum

Bug report: Code folding from plugin

#1

Select the menu item Tools->New Plugin, paste the following code

[code]import sublime

view = sublime.active_window().active_view()
endline, endcol = view.rowcol(view.size())
line = 0
regions = ]
while line < endline:
region = view.full_line(view.text_point(line, 0))
data = view.substr(region)
if data.startswith(“Hello”):
regions.append(region)
line += 1
view.fold(regions)

“”"
Hello
World!
Hello
World!
Hello
World!
Hello
World!
“”"
[/code]

And save. All the “Hello” lines will be folded up leaving us with only the “World!” lines, which is the correct behavior.

Now try to unfold these by moving the mouse cursor to the left and click on one of the triangles. The text is not unfolding, and also in my opinion the triangles are off by one line (the first triangle should be shown at the first World! and not the “”").

0 Likes

Bug: Manual/API Folding
Nightly Build 2198
#2

I can confirm this bug on my own plugin.

startup, version: 2198 windows x64 channel: nightly

0 Likes