-3

add_regions erases the previous regions with the same name.

Filipe Cabecinhas 12 years ago updated 12 years ago 0
add_regions() doesn't add regions. It replaces previous regions with the same name.

add_regions() with the same region name as a region already present in the view will replace the existing regions, instead of adding to them (as the name implies).

Example:
>>> v = sublime.windows()[0].active_view()
>>> v.add_regions('a', [v.full_line(v.text_point(133,0))], 'string', 'circle', sublime.HIDDEN)  # A circle is added, in line 133
>>> v.add_regions('a', [v.full_line(v.text_point(137,0))], 'string', 'circle', sublime.HIDDEN)  # The first circle is deleted and a circle is added to line 137

I was expecting to have two circles, one in line 133, one in line 137.

Regards,

  Filipe