Sublime Forum

Changing all views in current window


I am trying to make changes to all views in the current window. I am able to access and process each view, but changes using view.insert() and view.update() only occur in the current view.
I am using version 4169

window = self.view.window()
    update_count = 0

    if window:
        # Iterate through all open views in the window
        for view_to_update in window.views():
            view_to_update.insert(edit, 0, 'new_content\n')


The edit token that the run() method of a TextCommand gets is only valid for editing the buffer that the command was called for (i.e. self.view).

If you want to edit multiple views, then you need to implement a TextCommand that can make the edit for you and then iterate calling run_command() on each view.



Thanks for the response.