From fdedd625f0e305203b217be5a603854acd3551f3 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Wed, 29 Mar 2023 23:22:32 -0400 Subject: [PATCH] Adds sending of "next" hint to Commit Details nav --- src/system/mru.ts | 6 +++++- src/webviews/commitDetails/commitDetailsWebview.ts | 9 ++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/system/mru.ts b/src/system/mru.ts index fbff9c1..7d25515 100644 --- a/src/system/mru.ts +++ b/src/system/mru.ts @@ -31,7 +31,11 @@ export class MRU { this._position = 0; } - get(): T | undefined { + get(position?: number): T | undefined { + if (position != null) { + if (position < 0 || position >= this.stack.length) return undefined; + return this.stack[position]; + } return this.stack.length > 0 ? this.stack[0] : undefined; } diff --git a/src/webviews/commitDetails/commitDetailsWebview.ts b/src/webviews/commitDetails/commitDetailsWebview.ts index 00ced03..3da4434 100644 --- a/src/webviews/commitDetails/commitDetailsWebview.ts +++ b/src/webviews/commitDetails/commitDetailsWebview.ts @@ -25,7 +25,7 @@ import { serializeIssueOrPullRequest } from '../../git/models/issue'; import type { PullRequest } from '../../git/models/pullRequest'; import { serializePullRequest } from '../../git/models/pullRequest'; import type { GitRevisionReference } from '../../git/models/reference'; -import { getReferenceFromRevision } from '../../git/models/reference'; +import { getReferenceFromRevision, shortenRevision } from '../../git/models/reference'; import type { GitRemote } from '../../git/models/remote'; import type { ShowInCommitGraphCommandArgs } from '../../plus/webviews/graph/protocol'; import { executeCommand, executeCoreCommand } from '../../system/command'; @@ -80,6 +80,7 @@ interface Context { navigationStack: { count: number; position: number; + hint?: string; }; visible: boolean; @@ -537,10 +538,16 @@ export class CommitDetailsWebviewProvider implements WebviewProvider