From b31272c2c9f458cc6b3c2152066da84cf272214b Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Tue, 25 Aug 2020 03:08:56 -0400 Subject: [PATCH] Changes follow cursor to toggle mode file/line --- package.json | 8 ++++---- src/views/fileHistoryView.ts | 5 +++-- src/views/viewBase.ts | 11 +++++++++++ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 64e090d..a450175 100644 --- a/package.json +++ b/package.json @@ -3182,15 +3182,15 @@ }, { "command": "gitlens.views.fileHistory.setCursorFollowingOn", - "title": "Follow the Cursor", + "title": "Toggle Mode (File)", "category": "GitLens", - "icon": "$(eye)" + "icon": "$(file)" }, { "command": "gitlens.views.fileHistory.setCursorFollowingOff", - "title": "Unfollow the Cursor", + "title": "Toggle Mode (Line)", "category": "GitLens", - "icon": "$(eye-closed)" + "icon": "$(list-selection)" }, { "command": "gitlens.views.fileHistory.setRenameFollowingOn", diff --git a/src/views/fileHistoryView.ts b/src/views/fileHistoryView.ts index aff24f7..9997658 100644 --- a/src/views/fileHistoryView.ts +++ b/src/views/fileHistoryView.ts @@ -134,12 +134,13 @@ export class FileHistoryView extends ViewBase> implements TreeData this.updateTitle(); } + private _updateTitleDebounced: (() => void) | undefined = undefined; private updateTitle() { if (this._tree == null) return; + if (this._updateTitleDebounced === undefined) { + this._updateTitleDebounced = Functions.debounce(this.updateTitleCore.bind(this), 100); + } + + this._updateTitleDebounced(); + } + + private updateTitleCore() { + if (this._tree == null) return; + this._tree.title = `${this.title}${this.titleContext ? ` ${GlyphChars.Dot} ${this.titleContext}` : ''}${ this.description ? ` ${this.description}` : '' }`;