def run(self, edit, external=False, group=-1, index=-1): """Run command.""" if index != -1: # Ensure we have the correct view self.view = get_group_view(sublime.active_window(), group, index) diff(self.get_right(), external=external)
def get_mru_view(mru_obj): """Get MRU view.""" view = None if mru_obj is not None: win_id, group, index, view_id = mru_obj window = get_mru_window(win_id) v = get_group_view(window, group, index) if v and v.id() == view_id: view = v return view
def run(self, edit, group=-1, index=-1): """Run command.""" global LEFT if index != -1: # Ensure we have the correct view self.view = get_group_view(sublime.active_window(), group, index) LEFT = { "win_id": None, "view_id": None, "clip": EasyDiffView("**selection**", self.get_selections(), self.get_encoding()) } update_menu("**selection**")
def set_view(self, paths, group=-1, index=-1, open_file=True): """Set view.""" if len(paths): file_path = get_target(paths) if file_path is None: return if open_file: self.view = self.window.open_file(file_path) elif index != -1: self.view = get_group_view(self.window, group, index) else: self.view = self.window.active_view()
def view_has_selections(self, group=-1, index=-1): """Check if view has selections.""" has_selections = False if index != -1: view = get_group_view(sublime.active_window(), group, index) if view is not None: if bool(load_settings().get("multi_select", False)): for sel in view.sel(): if sel.size() > 0: has_selections = True break else: has_selections = len(view.sel()) == 1 and view.sel()[0].size() > 0 else: has_selections = self.has_selections() return has_selections
def view_has_selections(self, group=-1, index=-1): """Check if view has selections.""" has_selections = False if index != -1: view = get_group_view(sublime.active_window(), group, index) if view is not None: if bool(load_settings().get("multi_select", False)): for sel in view.sel(): if sel.size() > 0: has_selections = True break else: has_selections = len( view.sel()) == 1 and view.sel()[0].size() > 0 else: has_selections = self.has_selections() return has_selections
def run(self, paths=[], group=-1, index=-1, **kwargs): """Run command.""" if len(paths): name = get_target(paths) elif index != -1: self.view = get_group_view(sublime.active_window(), group, index) name = self.view.file_name() else: self.view = self.window.active_view() if self.view is None: return False name = self.view.file_name() if self.view is not None else None if name is None: return False if len(paths): self.view = self.window.open_file(name) self.vc_run(**kwargs)