@@ -5,7 +5,7 @@ import * as fn from "jsr:@denops/std@^7.3.2/function";
5
5
import * as buffer from "jsr:@denops/std@^7.3.2/buffer" ;
6
6
import type { Dimension } from "jsr:@vim-fall/core@^0.2.1/coordinator" ;
7
7
8
- import { BaseComponent } from "./_component.ts" ;
8
+ import { BaseComponent , ComponentProperties } from "./_component.ts" ;
9
9
10
10
export const HIGHLIGHT_MATCH = "FallListMatch" ;
11
11
export const SIGN_GROUP_SELECTED = "PopUpFallListSelected" ;
@@ -38,12 +38,32 @@ export type DisplayItem = {
38
38
*/
39
39
export class ListComponent extends BaseComponent {
40
40
#scroll = 1 ;
41
+ #title = "" ;
41
42
#items: readonly DisplayItem [ ] = [ ] ;
42
43
#selection = new Set < unknown > ( ) ;
43
44
#modifiedContent = true ;
44
45
#modifiedSigns = true ;
46
+ #modifiedWindow = true ;
45
47
#reservedCommands: string [ ] = [ ] ;
46
48
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
+
47
67
/**
48
68
* Gets the scroll setting of the list.
49
69
*/
@@ -141,6 +161,7 @@ export class ListComponent extends BaseComponent {
141
161
) : Promise < true | void > {
142
162
try {
143
163
const results = [
164
+ await this . #renderWindow( denops , { signal } ) ,
144
165
await this . #renderContent( denops , { signal } ) ,
145
166
await this . #placeSigns( denops , { signal } ) ,
146
167
await this . #executeCommands( denops , { signal } ) ,
@@ -153,6 +174,20 @@ export class ListComponent extends BaseComponent {
153
174
}
154
175
}
155
176
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
+
156
191
async #renderContent(
157
192
denops : Denops ,
158
193
{ signal } : { signal ?: AbortSignal } = { } ,
0 commit comments