@@ -5,7 +5,7 @@ import * as fn from "jsr:@denops/std@^7.3.2/function";
55import * as buffer from "jsr:@denops/std@^7.3.2/buffer" ;
66import type { Dimension } from "jsr:@vim-fall/core@^0.2.1/coordinator" ;
77
8- import { BaseComponent } from "./_component.ts" ;
8+ import { BaseComponent , ComponentProperties } from "./_component.ts" ;
99
1010export const HIGHLIGHT_MATCH = "FallListMatch" ;
1111export const SIGN_GROUP_SELECTED = "PopUpFallListSelected" ;
@@ -38,12 +38,32 @@ export type DisplayItem = {
3838 */
3939export class ListComponent extends BaseComponent {
4040 #scroll = 1 ;
41+ #title = "" ;
4142 #items: readonly DisplayItem [ ] = [ ] ;
4243 #selection = new Set < unknown > ( ) ;
4344 #modifiedContent = true ;
4445 #modifiedSigns = true ;
46+ #modifiedWindow = true ;
4547 #reservedCommands: string [ ] = [ ] ;
4648
49+ constructor (
50+ params : ComponentProperties = { } ,
51+ ) {
52+ super ( params ) ;
53+ this . #title = params . title ?? "" ;
54+ }
55+
56+ /** The title of the input component */
57+ get title ( ) : string {
58+ return this . #title;
59+ }
60+
61+ /** Sets the title of the input component */
62+ set title ( value : string ) {
63+ this . #title = value ;
64+ this . #modifiedWindow = true ;
65+ }
66+
4767 /**
4868 * Gets the scroll setting of the list.
4969 */
@@ -141,6 +161,7 @@ export class ListComponent extends BaseComponent {
141161 ) : Promise < true | void > {
142162 try {
143163 const results = [
164+ await this . #renderWindow( denops , { signal } ) ,
144165 await this . #renderContent( denops , { signal } ) ,
145166 await this . #placeSigns( denops , { signal } ) ,
146167 await this . #executeCommands( denops , { signal } ) ,
@@ -153,6 +174,20 @@ export class ListComponent extends BaseComponent {
153174 }
154175 }
155176
177+ async #renderWindow(
178+ denops : Denops ,
179+ { signal } : { signal ?: AbortSignal } = { } ,
180+ ) : Promise < true | void > {
181+ if ( ! this . info ) return ;
182+ if ( ! this . #modifiedWindow) return ;
183+ this . #modifiedWindow = false ;
184+
185+ await this . update ( denops , {
186+ title : this . #title ? ` ${ this . #title} ` : undefined ,
187+ } ) ;
188+ signal ?. throwIfAborted ( ) ;
189+ }
190+
156191 async #renderContent(
157192 denops : Denops ,
158193 { signal } : { signal ?: AbortSignal } = { } ,
0 commit comments