

def move_to_file(self, which=1, where=None):
    if isinstance(which, int):
        files = self.get_all_file_regions()
        if files:
            if (len(files) >= which):
                self.move_to_region(self.view.line(files[(which - 1)]))
            else:
                self.move_to_region(self.view.line(files[(- 1)]))
        elif self.get_all_stash_regions():
            self.move_to_stash(1)
        elif self.view.find(GIT_WORKING_DIR_CLEAN, 0, sublime.LITERAL):
            region = self.view.find(GIT_WORKING_DIR_CLEAN, 0, sublime.LITERAL)
            self.move_to_region(region)
    elif (which in ('next', 'prev')):
        point = self.get_first_point()
        regions = self.get_all_file_regions()
        if (point and regions):
            next = self.next_or_prev_region(which, regions, point)
            region.move_to_region(next)
    elif (which and where):
        regions = self.get_all_file_regions()
        section_regions = [r for r in regions if (self.section_at_region(r) == where)]
        if section_regions:
            prev_regions = [r for r in section_regions if (self.view.substr(r) < which)]
            next_regions = [r for r in section_regions if (self.view.substr(r) >= which)]
            if next_regions:
                next = next_regions[0]
            else:
                next = prev_regions[(- 1)]
            self.move_to_region(next)
        else:
            sections = set([self.section_at_region(r) for r in regions])
            idx = SECTION_ORDER.index(where)
            while (idx > 0):
                idx -= 1
                section = SECTION_ORDER[idx]
                if (section in sections):
                    section_regions = [r for r in regions if (self.section_at_region(r) == section)]
                    self.move_to_region(section_regions[(- 1)])
                    return
            self.move_to_file(1)

dataset/ETHPy150Open SublimeGit/SublimeGit/sgit/status.py GitStatusMoveCmd.move_to_file/VarMisuse@213/268 `self`->`region`