Hi,
How do I get and modify (replace) the entire contents of a view?
Thanks in advance!
# get the current contents of the file
body = self.window.active_view().substr(sublime.Region(0, self.window.active_view().size()))
# begin edit
edit = self.window.active_view().begin_edit()
# deleted the contents of the file
self.window.active_view().erase(edit, sublime.Region(0, self.window.active_view().size()))
# insert new html
self.window.active_view().insert(edit, 0, html)
# end edit
self.window.active_view().end_edit(edit)Users browsing this forum: No registered users and 4 guests