fun down()

in src/main/kotlin/com/jetbrains/interactiveRebase/listeners/BranchNavigationListener.kt [95:118]


    fun down() {
        project.takeAction {
            val branch = modelService.getSelectedBranch()
            if (branch.selectedCommits.size == 0) {
                val commit = branch.currentCommits[0]
                modelService.selectSingleCommit(commit, branch)
                return@takeAction
            }
            var commit = modelService.getLastSelectedCommit()

            val index = branch.currentCommits.indexOf(commit)
            if (index == branch.currentCommits.size - 1) {
                commit = branch.currentCommits[index]
                modelService.selectSingleCommit(commit, branch)
                return@takeAction
            }

            commit = branch.currentCommits[index + 1]
            if (commit.isCollapsed) {
                commit = branch.currentCommits[index + 2]
            }
            modelService.selectSingleCommit(commit, branch)
        }
    }