From 0fcd87085ba475b31f783474ebe89666bea87559 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 22 Dec 2021 09:26:19 -0800 Subject: [PATCH] Name line cache entry type --- addons/xterm-addon-search/src/SearchAddon.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/xterm-addon-search/src/SearchAddon.ts b/addons/xterm-addon-search/src/SearchAddon.ts index c6494c58..155d5070 100644 --- a/addons/xterm-addon-search/src/SearchAddon.ts +++ b/addons/xterm-addon-search/src/SearchAddon.ts @@ -24,6 +24,8 @@ export interface ISearchResult { size: number; } +type LineCacheEntry = [lineAsString: string, offsets: number[]]; + const NON_WORD_CHARACTERS = ' ~!@#$%^&*()+`-=[]{}|\\;:"\',./<>?'; const LINES_CACHE_TIME_TO_LIVE = 15 * 1000; // 15 secs @@ -35,7 +37,7 @@ export class SearchAddon implements ITerminalAddon { * We memoize the calls into an array that has a time based ttl. * _linesCache is also invalidated when the terminal cursor moves. */ - private _linesCache: [string, number[]][] | undefined; + private _linesCache: LineCacheEntry[] | undefined; private _linesCacheTimeoutId = 0; private _cursorMoveListener: IDisposable | undefined; private _resizeListener: IDisposable | undefined; @@ -403,7 +405,7 @@ export class SearchAddon implements ITerminalAddon { * @param line The line being translated. * @param trimRight Whether to trim whitespace to the right. */ - private _translateBufferLineToStringWithWrap(lineIndex: number, trimRight: boolean): [string, number[]] { + private _translateBufferLineToStringWithWrap(lineIndex: number, trimRight: boolean): LineCacheEntry { const terminal = this._terminal!; const strings = []; const offsets = [0];