Skip to content

Commit

Permalink
feat: copy only 7 chars of hash
Browse files Browse the repository at this point in the history
  • Loading branch information
kometenstaub committed Apr 2, 2024
1 parent 30429f6 commit 1911629
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/git_diff_view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,14 @@ export default class GitDiffView extends DiffView {
}

hash.style.cursor = 'copy';
hash.addEventListener('click', async () => {
await navigator.clipboard.writeText(version.hash);
hash.addEventListener('click', async (mod) => {
if (mod.shiftKey) {
navigator.clipboard.writeText(version.hash);
} else {
await navigator.clipboard.writeText(
version.hash.slice(0, 7)
);
}
});
versionList.push({
html: div,
Expand Down

0 comments on commit 1911629

Please sign in to comment.