@@ -14,6 +14,8 @@ export interface IHighlight {
1414
1515 foregroundColor ?: string
1616 backgroundColor ?: string
17+ specialColor ?: string
18+
1719 isItalicAvailable ?: boolean
1820 isBoldAvailable ?: boolean
1921}
@@ -64,9 +66,12 @@ export interface ICell {
6466
6567 foregroundColor ?: string
6668 backgroundColor ?: string
69+ specialColor ?: string
70+
6771 italic ?: boolean
6872 bold ?: boolean
6973 underline ?: boolean
74+ undercurl ?: boolean
7075}
7176
7277export interface IPixelPosition {
@@ -93,6 +98,7 @@ const DefaultCell: ICell = {
9398
9499export class NeovimScreen implements IScreen {
95100 private _backgroundColor : string = "#000000"
101+ private _specialColor : string = "#000000"
96102 private _currentHighlight : IHighlight = { }
97103 private _cursorColumn : number = 0
98104 private _cursorRow : number = 0
@@ -161,6 +167,10 @@ export class NeovimScreen implements IScreen {
161167 return this . _foregroundColor
162168 }
163169
170+ public get specialColor ( ) : string {
171+ return this . _specialColor
172+ }
173+
164174 public get currentForegroundColor ( ) : string {
165175 return this . _currentHighlight . foregroundColor || this . _foregroundColor
166176 }
@@ -169,6 +179,10 @@ export class NeovimScreen implements IScreen {
169179 return this . _currentHighlight . backgroundColor || this . _backgroundColor
170180 }
171181
182+ public get currentSpecialColor ( ) : string {
183+ return this . _currentHighlight . specialColor || this . _specialColor
184+ }
185+
172186 public getCell = ( x : number , y : number ) => {
173187 const cell = this . _grid . getCell ( x , y )
174188
@@ -190,14 +204,18 @@ export class NeovimScreen implements IScreen {
190204 this . _currentHighlight . foregroundColor || this . _foregroundColor
191205 let backgroundColor =
192206 this . _currentHighlight . backgroundColor || this . _backgroundColor
207+ const specialColor = this . _currentHighlight . specialColor || this . _specialColor
193208
209+ // `:help ui-event-highlight_set` specifies that the background and foreground colours
210+ // are swapped if reversed is set. The special colour is not mentioned, which is why it
211+ // is omitted here.
194212 if ( this . _currentHighlight . reverse ) {
195213 const temp = foregroundColor
196214 foregroundColor = backgroundColor
197215 backgroundColor = temp
198216 }
199217
200- const { underline, bold, italic } = this . _currentHighlight
218+ const { underline, undercurl , bold, italic } = this . _currentHighlight
201219
202220 const characters = action . characters
203221 const row = this . _cursorRow
@@ -211,22 +229,26 @@ export class NeovimScreen implements IScreen {
211229 this . _setCell ( col + i , row , {
212230 foregroundColor,
213231 backgroundColor,
232+ specialColor,
214233 character,
215234 characterWidth,
216235 italic,
217236 bold,
218237 underline,
238+ undercurl,
219239 } )
220240
221241 for ( let c = 1 ; c < characterWidth ; c ++ ) {
222242 this . _setCell ( col + i + c , row , {
223243 foregroundColor,
224244 backgroundColor,
245+ specialColor,
225246 character : "" ,
226247 characterWidth : 0 ,
227248 italic,
228249 bold,
229250 underline,
251+ undercurl,
230252 } )
231253 }
232254
@@ -241,17 +263,20 @@ export class NeovimScreen implements IScreen {
241263 this . _currentHighlight . foregroundColor || this . _foregroundColor
242264 const backgroundColor =
243265 this . _currentHighlight . backgroundColor || this . _backgroundColor
266+ const specialColor = this . _currentHighlight . specialColor || this . _specialColor
244267
245268 const row = this . _cursorRow
246269 for ( let i = this . _cursorColumn ; i < this . width ; i ++ ) {
247270 this . _setCell ( i , row , {
248271 foregroundColor,
249272 backgroundColor,
273+ specialColor,
250274 character : "" ,
251275 characterWidth : 1 ,
252276 bold : this . _currentHighlight . bold ,
253277 italic : this . _currentHighlight . italic ,
254278 underline : this . _currentHighlight . underline ,
279+ undercurl : this . _currentHighlight . undercurl ,
255280 } )
256281 }
257282 break
@@ -289,6 +314,7 @@ export class NeovimScreen implements IScreen {
289314 const { isBoldAvailable, isItalicAvailable } = this . _currentHighlight
290315 this . _currentHighlight . foregroundColor = action . foregroundColor
291316 this . _currentHighlight . backgroundColor = action . backgroundColor
317+ this . _currentHighlight . specialColor = action . specialColor
292318 this . _currentHighlight . reverse = ! ! action . reverse
293319 this . _currentHighlight . bold = isBoldAvailable ? action . bold : false
294320 this . _currentHighlight . italic = isItalicAvailable ? action . italic : false
0 commit comments