fun shiftUp()

in src/main/kotlin/com/jetbrains/interactiveRebase/listeners/BranchNavigationListener.kt [126:151]


    fun shiftUp() {
        project.takeAction {
            val branch = modelService.getSelectedBranch()
            if (branch.selectedCommits.size == 0) {
                val commit = branch.currentCommits.last()
                modelService.addToSelectedCommits(commit, branch)
                return@takeAction
            }
            val commit = modelService.getLastSelectedCommit()

            val index = branch.currentCommits.indexOf(commit)
            if (index == 0) {
                return@takeAction
            }

            var nextCommit = branch.currentCommits[index - 1]
            if (nextCommit.isCollapsed) {
                nextCommit = branch.currentCommits[index - 2]
            }
            if (!nextCommit.isSelected) {
                modelService.addToSelectedCommits(nextCommit, branch)
            } else {
                modelService.removeFromSelectedCommits(commit, branch)
            }
        }
    }