def replaceSelections(self, threads, lastError):
        '''Replace the content of a list of selections.
        This is called when there are multiple cursors or a selection of text'''
        if (lastError):
            sublime.error_message("Error (2):" + lastError)
        else:
            # Modify the selections from top to bottom to account for different text length
            offset = 0
            regions = []
            for thread in sorted(threads, key=lambda t: t.region.begin()):
                if thread.code == thread.result.encode('utf-8'):
                    continue
                if offset:
                    region = [thread.region.begin() + offset, thread.region.end() + offset, thread.result]
                else:
                    region = [thread.region.begin(), thread.region.end(), thread.result]
                offset += len(thread.result) - len(thread.code)
                regions.append(region)
            self.view.run_command("esformat_update_content", {"regions": regions})
dataset/ETHPy150Open piuccio/sublime-esformatter/EsFormatter.py/EsformatterCommand.replaceSelections/original