Skip to content

Commit

Permalink
when scrolling to branch tip, also select the respective commit
Browse files Browse the repository at this point in the history
  • Loading branch information
phil294 committed Sep 17, 2022
1 parent c861a8b commit 59b478d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions web/src/views/MainView.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ export default
return show_error_message "No commit found for branch #{branch.name}. No idea why :/"
commits_scroller_ref.value?.scrollToItem first_branch_commit_i
show_invisible_branches.value = false
# Not only scroll to tip, but also select it, so the behavior is equal to clicking on
# a branch name in a commit's ref list.
selected_commit.value = commits.value[first_branch_commit_i]

commit_clicked = (###* @type {Commit} ### commit) =>
show_invisible_branches.value = false
Expand Down
4 changes: 2 additions & 2 deletions web/src/views/MainView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
nav.row.align-center.justify-space-between.gap-10
ul#branches.row.align-center.wrap
li.ref.branch.visible.active v-for="branch of visible_branches" :class="{is_head:branch.name===head_branch, is_hovered:branch.name===hovered_branch_name}"
button :style="{color:branch.color}" @click="scroll_to_branch_tip(branch)"
button :style="{color:branch.color}" @click="scroll_to_branch_tip(branch)" title="Jump to branch tip"
| {{ branch.name }}
li.show-invisible_branches v-if="invisible_branches.length"
button @click="show_invisible_branches = ! show_invisible_branches"
| Show all >>
template v-if="show_invisible_branches"
li.ref.branch.invisible v-for="branch of invisible_branches"
button :style="{color:branch.color}" @click="scroll_to_branch_tip(branch)"
button :style="{color:branch.color}" @click="scroll_to_branch_tip(branch)" title="Jump to branch tip"
| {{ branch.name }}
li Click on any of the branch names to scroll to the tip of it.
aside#actions.center.gap-5
Expand Down

0 comments on commit 59b478d

Please sign in to comment.