@@ -7,12 +7,10 @@ import type { SerializeAddon as SerializeAddonType } from '@xterm/addon-serializ
77import type { IBufferLine , IMarker , ITerminalOptions , ITheme , Terminal as RawXtermTerminal , Terminal as XTermTerminal } from '@xterm/xterm' ;
88import { importAMDNodeModule } from 'vs/amdX' ;
99import { $ , addDisposableListener , addStandardDisposableListener , getWindow } from 'vs/base/browser/dom' ;
10- import { KeybindingLabel } from 'vs/base/browser/ui/keybindingLabel/keybindingLabel' ;
1110import { CancelablePromise , createCancelablePromise } from 'vs/base/common/async' ;
1211import { debounce , memoize , throttle } from 'vs/base/common/decorators' ;
1312import { Event } from 'vs/base/common/event' ;
1413import { Disposable , MutableDisposable , combinedDisposable , toDisposable } from 'vs/base/common/lifecycle' ;
15- import { OS } from 'vs/base/common/platform' ;
1614import 'vs/css!./media/stickyScroll' ;
1715import { localize } from 'vs/nls' ;
1816import { IMenu , IMenuService , MenuId } from 'vs/platform/actions/common/actions' ;
@@ -27,7 +25,8 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
2725import { ITerminalInstance , IXtermColorProvider , IXtermTerminal } from 'vs/workbench/contrib/terminal/browser/terminal' ;
2826import { openContextMenu } from 'vs/workbench/contrib/terminal/browser/terminalContextMenu' ;
2927import { IXtermCore } from 'vs/workbench/contrib/terminal/browser/xterm-private' ;
30- import { TERMINAL_CONFIG_SECTION } from 'vs/workbench/contrib/terminal/common/terminal' ;
28+ import { TERMINAL_CONFIG_SECTION , TerminalCommandId } from 'vs/workbench/contrib/terminal/common/terminal' ;
29+ import { terminalStrings } from 'vs/workbench/contrib/terminal/common/terminalStrings' ;
3130import { terminalStickyScrollHoverBackground } from 'vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollColorRegistry' ;
3231
3332const enum OverlayState {
@@ -327,28 +326,23 @@ export class TerminalStickyScrollOverlay extends Disposable {
327326 this . _xterm . raw . element . parentElement . append ( this . _element ) ;
328327 this . _register ( toDisposable ( ( ) => this . _element ?. remove ( ) ) ) ;
329328
330- // Create command navigation keybinding hint if appropriate
331- const scrollToPreviousCommandKeybinding = this . _keybindingService . lookupKeybinding ( 'workbench.action.terminal.scrollToPreviousCommand' ) ;
329+ // Fill tooltip
330+ let hoverTitle = localize ( 'stickyScrollHoverTitle' , 'Navigate to Command' ) ;
331+ const scrollToPreviousCommandKeybinding = this . _keybindingService . lookupKeybinding ( TerminalCommandId . ScrollToPreviousCommand ) ;
332332 if ( scrollToPreviousCommandKeybinding ) {
333- const keybindingHint = $ ( '.keybinding-hint' ) ;
334- const localizedText = localize ( {
335- key : 'command-navigation-hint' ,
336- comment : [ '{0} is the localized keybinding to navigate commands' ]
337- } , '{0} to navigate commands' , '{0}' ) ;
338- const localizedTextPrefix = localizedText . substring ( 0 , localizedText . indexOf ( '{0}' ) ) ;
339- const localizedTextSuffix = localizedText . substring ( localizedText . indexOf ( '{0}' ) + 3 ) ;
340- const label = new KeybindingLabel ( keybindingHint , OS ) ;
341- label . set ( scrollToPreviousCommandKeybinding ) ;
342- // Insert and use a non-breaking space for boundaries to space out naturally
343- if ( localizedTextPrefix ) {
344- label . element . insertAdjacentText ( 'beforebegin' , localizedTextPrefix . replace ( / $ / , '\u00A0' ) ) ;
333+ const label = scrollToPreviousCommandKeybinding . getLabel ( ) ;
334+ if ( label ) {
335+ hoverTitle += '\n' + localize ( 'labelWithKeybinding' , "{0} ({1})" , terminalStrings . scrollToPreviousCommand . value , label ) ;
345336 }
346- if ( localizedTextSuffix ) {
347- label . element . insertAdjacentText ( 'afterend' , localizedTextSuffix . replace ( / ^ / , '\u00A0' ) ) ;
337+ }
338+ const scrollToNextCommandKeybinding = this . _keybindingService . lookupKeybinding ( TerminalCommandId . ScrollToNextCommand ) ;
339+ if ( scrollToNextCommandKeybinding ) {
340+ const label = scrollToNextCommandKeybinding . getLabel ( ) ;
341+ if ( label ) {
342+ hoverTitle += '\n' + localize ( 'labelWithKeybinding' , "{0} ({1})" , terminalStrings . scrollToNextCommand . value , label ) ;
348343 }
349-
350- hoverOverlay . append ( keybindingHint ) ;
351344 }
345+ hoverOverlay . title = hoverTitle ;
352346
353347 const scrollBarWidth = ( this . _xterm . raw as any as { _core : IXtermCore } ) . _core . viewport ?. scrollBarWidth ;
354348 if ( scrollBarWidth !== undefined ) {
0 commit comments