Skip to content

Commit 375e1a7

Browse files
committed
feat: double click show the detail panel
1 parent f84bc51 commit 375e1a7

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

src/constant.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
export const WEBVIEW_CHANNEL = {
33
GET_HISTORY: 'get-history',
44
SHOW_COMMIT_DETAILS: 'show-commit-details',
5+
SHOW_CHANGES_PANEL: 'show-changes-panel',
56
} as const
67

78
// vscode to webview channel

src/views/history/components/CommitTable.vue

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,19 @@ function handleCommitClick(commit: Commit & { date: string }) {
3939
}
4040
}
4141
42+
function handleDoubleClick() {
43+
try {
44+
if (window.vscode) {
45+
window.vscode.postMessage({
46+
command: WEBVIEW_CHANNEL.SHOW_CHANGES_PANEL,
47+
})
48+
}
49+
}
50+
catch (error) {
51+
console.error('Error sending commit details:', error)
52+
}
53+
}
54+
4255
// Calculate branch positions and paths
4356
// const COLUMN_WIDTH = 14
4457
// const DOT_SIZE = 6
@@ -107,6 +120,7 @@ onUnmounted(() => {
107120
:key="commit.hash"
108121
class="commit-row"
109122
@click="handleCommitClick(commit)"
123+
@dblclick="handleDoubleClick"
110124
>
111125
<td class="hash-col">
112126
{{ commit.hash.substring(0, 7) }}

src/views/webview.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ export class GitPanelViewProvider implements WebviewViewProvider {
8686
case WEBVIEW_CHANNEL.SHOW_COMMIT_DETAILS:
8787
try {
8888
this.gitChangesProvider.refresh(message.commitHash)
89-
await commands.executeCommand('git.showCommitDetails', message.commitHash)
9089
}
9190
catch (error) {
9291
webviewView.webview.postMessage({
@@ -95,6 +94,9 @@ export class GitPanelViewProvider implements WebviewViewProvider {
9594
})
9695
}
9796
break
97+
case WEBVIEW_CHANNEL.SHOW_CHANGES_PANEL:
98+
await commands.executeCommand('git-panel.changes.focus')
99+
break
98100

99101
case 'clearHistory':
100102
this.storageService.clearCommits()

0 commit comments

Comments
 (0)