@@ -49,6 +49,8 @@ import { IExtensionService } from 'vs/workbench/services/extensions/common/exten
4949import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace' ;
5050import { IViewsRegistry , IViewDescriptor , Extensions } from 'vs/workbench/common/views' ;
5151import { Registry } from 'vs/platform/registry/common/platform' ;
52+ import { ScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement' ;
53+ import { ScrollbarVisibility } from 'vs/base/common/scrollable' ;
5254
5355export interface ISpliceEvent < T > {
5456 index : number ;
@@ -711,6 +713,7 @@ export class RepositoryPanel extends ViewletPanel {
711713 private cachedScrollTop : number | undefined = undefined ;
712714 private inputBoxContainer : HTMLElement ;
713715 private inputBox : InputBox ;
716+ private scrollableElement : ScrollableElement ;
714717 private listContainer : HTMLElement ;
715718 private list : List < ISCMResourceGroup | ISCMResource > ;
716719 private listLabels : ResourceLabels ;
@@ -804,6 +807,31 @@ export class RepositoryPanel extends ViewletPanel {
804807
805808 this . _register ( this . inputBox . onDidChange ( triggerValidation , null ) ) ;
806809
810+ this . scrollableElement = new ScrollableElement ( this . inputBox . element , {
811+ vertical : ScrollbarVisibility . Visible
812+ } ) ;
813+
814+ this . disposables . push ( this . scrollableElement ) ;
815+
816+ this . scrollableElement . onScroll ( ( e ) => {
817+ this . scrollInput ( e . scrollTop ) ;
818+ } ) ;
819+
820+ append ( this . inputBoxContainer , this . scrollableElement . getDomNode ( ) ) ;
821+
822+ const updateScrollDimensions = ( ) => {
823+ const scrollHeight = this . inputBox . height ;
824+ const height = scrollHeight > 134 ? 134 : scrollHeight ;
825+ const scrollTop = this . inputBox . scrollTop ;
826+
827+ this . scrollableElement . setScrollDimensions ( { scrollHeight : scrollHeight , height : height } ) ;
828+ this . scrollableElement . setScrollPosition ( { scrollTop : scrollTop } ) ;
829+ } ;
830+
831+ this . inputBox . element . style . maxHeight = '134px' ;
832+ this . inputBox . onDidHeightChange ( updateScrollDimensions , null , this . disposables ) ;
833+ this . inputBox . onDidScrollTopChange ( updateScrollDimensions , null , this . disposables ) ;
834+
807835 const onKeyUp = domEvent ( this . inputBox . inputElement , 'keyup' ) ;
808836 const onMouseUp = domEvent ( this . inputBox . inputElement , 'mouseup' ) ;
809837 this . _register ( Event . any < any > ( onKeyUp , onMouseUp ) ( triggerValidation , null ) ) ;
@@ -871,6 +899,10 @@ export class RepositoryPanel extends ViewletPanel {
871899 this . onDidChangeBodyVisibility ( visible => this . inputBox . setEnabled ( visible ) ) ;
872900 }
873901
902+ private scrollInput ( scrollTop : number ) : void {
903+ this . inputBox . element . scrollTop = scrollTop ;
904+ }
905+
874906 private onDidChangeVisibility ( visible : boolean ) : void {
875907 if ( visible ) {
876908 const listSplicer = new ResourceGroupSplicer ( this . repository . provider . groups , this . list ) ;
@@ -892,15 +924,12 @@ export class RepositoryPanel extends ViewletPanel {
892924 removeClass ( this . inputBoxContainer , 'hidden' ) ;
893925 this . inputBox . layout ( ) ;
894926
895- const editorHeight = this . inputBox . height ;
927+ const editorHeight = this . inputBox . height > 134 ? 134 : this . inputBox . height ;
896928 const listHeight = height - ( editorHeight + 12 /* margin */ ) ;
897929 this . listContainer . style . height = `${ listHeight } px` ;
898930 this . list . layout ( listHeight , width ) ;
899-
900- toggleClass ( this . inputBoxContainer , 'scroll' , editorHeight >= 134 ) ;
901931 } else {
902932 addClass ( this . inputBoxContainer , 'hidden' ) ;
903- removeClass ( this . inputBoxContainer , 'scroll' ) ;
904933
905934 this . listContainer . style . height = `${ height } px` ;
906935 this . list . layout ( height , width ) ;
0 commit comments