@lvce-editor/text-search-worker 5.23.0 → 5.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -4
- package/dist/textSearchWorkerMain.js +265 -172
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1226,6 +1226,7 @@ const TargetName = 'event.target.name';
|
|
|
1226
1226
|
const TargetValue = 'event.target.value';
|
|
1227
1227
|
|
|
1228
1228
|
const Search$1 = 18;
|
|
1229
|
+
const InputContextMenu$1 = 91;
|
|
1229
1230
|
|
|
1230
1231
|
const None$1 = 0;
|
|
1231
1232
|
|
|
@@ -1731,7 +1732,7 @@ const collapseDetails = state => {
|
|
|
1731
1732
|
};
|
|
1732
1733
|
};
|
|
1733
1734
|
|
|
1734
|
-
const copy = async state => {
|
|
1735
|
+
const copy$1 = async state => {
|
|
1735
1736
|
const {
|
|
1736
1737
|
items,
|
|
1737
1738
|
focusedIndex
|
|
@@ -1918,6 +1919,132 @@ const diff2 = uid => {
|
|
|
1918
1919
|
return diffResult;
|
|
1919
1920
|
};
|
|
1920
1921
|
|
|
1922
|
+
const getFilePath = text => {
|
|
1923
|
+
// TODO make api stricter so that results always have the same shape
|
|
1924
|
+
if (text.startsWith('./')) {
|
|
1925
|
+
return text.slice(2);
|
|
1926
|
+
}
|
|
1927
|
+
return text;
|
|
1928
|
+
};
|
|
1929
|
+
|
|
1930
|
+
const getIconsCached = (dirents, fileIconCache) => {
|
|
1931
|
+
return dirents.map(dirent => {
|
|
1932
|
+
if (dirent.type === Match$1) {
|
|
1933
|
+
return '';
|
|
1934
|
+
}
|
|
1935
|
+
const path = getFilePath(dirent.text);
|
|
1936
|
+
return fileIconCache[path];
|
|
1937
|
+
});
|
|
1938
|
+
};
|
|
1939
|
+
|
|
1940
|
+
const getFileName = path => {
|
|
1941
|
+
const slashIndex = path.lastIndexOf('/');
|
|
1942
|
+
if (slashIndex === -1) {
|
|
1943
|
+
return path;
|
|
1944
|
+
}
|
|
1945
|
+
return path.slice(slashIndex + 1);
|
|
1946
|
+
};
|
|
1947
|
+
|
|
1948
|
+
const isFile = match => {
|
|
1949
|
+
return match.type === File;
|
|
1950
|
+
};
|
|
1951
|
+
|
|
1952
|
+
const getMissingDirents = (searchResults, fileIconCache) => {
|
|
1953
|
+
const missingDirents = [];
|
|
1954
|
+
const files = searchResults.filter(isFile);
|
|
1955
|
+
for (const file of files) {
|
|
1956
|
+
const uri = getFilePath(file.text);
|
|
1957
|
+
if (!(uri in fileIconCache)) {
|
|
1958
|
+
missingDirents.push(file);
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
return missingDirents;
|
|
1962
|
+
};
|
|
1963
|
+
const toIconRequest = item => {
|
|
1964
|
+
const filePath = getFilePath(item.text);
|
|
1965
|
+
const fileName = getFileName(filePath);
|
|
1966
|
+
return {
|
|
1967
|
+
type: File$1,
|
|
1968
|
+
name: fileName,
|
|
1969
|
+
path: filePath
|
|
1970
|
+
};
|
|
1971
|
+
};
|
|
1972
|
+
const getMissingIconRequests = (dirents, fileIconCache) => {
|
|
1973
|
+
const missingRequests = getMissingDirents(dirents, fileIconCache);
|
|
1974
|
+
const iconRequests = missingRequests.map(toIconRequest);
|
|
1975
|
+
return iconRequests;
|
|
1976
|
+
};
|
|
1977
|
+
|
|
1978
|
+
const Directory = 3;
|
|
1979
|
+
const DirectoryExpanded = 4;
|
|
1980
|
+
|
|
1981
|
+
const getSimpleIconRequestType = direntType => {
|
|
1982
|
+
if (direntType === Directory || direntType === DirectoryExpanded) {
|
|
1983
|
+
return 2;
|
|
1984
|
+
}
|
|
1985
|
+
return 1;
|
|
1986
|
+
};
|
|
1987
|
+
|
|
1988
|
+
const toSimpleIconRequest = request => {
|
|
1989
|
+
return {
|
|
1990
|
+
name: request.name,
|
|
1991
|
+
type: getSimpleIconRequestType(request.type)
|
|
1992
|
+
};
|
|
1993
|
+
};
|
|
1994
|
+
|
|
1995
|
+
const requestFileIcons = async requests => {
|
|
1996
|
+
if (requests.length === 0) {
|
|
1997
|
+
return [];
|
|
1998
|
+
}
|
|
1999
|
+
const simpleRequests = requests.map(toSimpleIconRequest);
|
|
2000
|
+
const icons = await getIcons(simpleRequests);
|
|
2001
|
+
return icons;
|
|
2002
|
+
};
|
|
2003
|
+
|
|
2004
|
+
const updateIconCache = (iconCache, missingRequests, newIcons) => {
|
|
2005
|
+
if (missingRequests.length === 0) {
|
|
2006
|
+
return iconCache;
|
|
2007
|
+
}
|
|
2008
|
+
const newFileIconCache = {
|
|
2009
|
+
...iconCache
|
|
2010
|
+
};
|
|
2011
|
+
for (let i = 0; i < missingRequests.length; i++) {
|
|
2012
|
+
const request = missingRequests[i];
|
|
2013
|
+
const icon = newIcons[i];
|
|
2014
|
+
newFileIconCache[request.path] = icon;
|
|
2015
|
+
}
|
|
2016
|
+
return newFileIconCache;
|
|
2017
|
+
};
|
|
2018
|
+
|
|
2019
|
+
const getFileIcons = async (items, fileIconCache) => {
|
|
2020
|
+
const missingRequests = getMissingIconRequests(items, fileIconCache);
|
|
2021
|
+
const newIcons = await requestFileIcons(missingRequests);
|
|
2022
|
+
const newFileIconCache = updateIconCache(fileIconCache, missingRequests, newIcons);
|
|
2023
|
+
const icons = getIconsCached(items, newFileIconCache);
|
|
2024
|
+
return {
|
|
2025
|
+
icons,
|
|
2026
|
+
newFileIconCache
|
|
2027
|
+
};
|
|
2028
|
+
};
|
|
2029
|
+
|
|
2030
|
+
const getNewMinMax = (newItemsLength, minLineY, maxLineY, deltaY, itemHeight) => {
|
|
2031
|
+
if (maxLineY > newItemsLength) {
|
|
2032
|
+
const diff = maxLineY - minLineY;
|
|
2033
|
+
const newMinLineY = Math.max(newItemsLength - diff, 0);
|
|
2034
|
+
const newDeltaY = newMinLineY * itemHeight;
|
|
2035
|
+
return {
|
|
2036
|
+
newDeltaY,
|
|
2037
|
+
newMinLineY,
|
|
2038
|
+
newMaxLineY: newItemsLength
|
|
2039
|
+
};
|
|
2040
|
+
}
|
|
2041
|
+
return {
|
|
2042
|
+
newDeltaY: deltaY,
|
|
2043
|
+
newMinLineY: minLineY,
|
|
2044
|
+
newMaxLineY: maxLineY
|
|
2045
|
+
};
|
|
2046
|
+
};
|
|
2047
|
+
|
|
1921
2048
|
// based on https://github.com/microsoft/vscode/blob/c0769274fa136b45799edeccc0d0a2f645b75caf/src/vs/base/common/arrays.ts#L625 (License MIT)
|
|
1922
2049
|
|
|
1923
2050
|
const remove$1 = (array, index, deleteCount) => {
|
|
@@ -1996,6 +2123,18 @@ const removeItemFromItems = (items, index, matchCount, fileCount) => {
|
|
|
1996
2123
|
};
|
|
1997
2124
|
};
|
|
1998
2125
|
|
|
2126
|
+
const getScrollBarSize$1 = (size, contentSize, minimumSliderSize) => {
|
|
2127
|
+
if (size >= contentSize) {
|
|
2128
|
+
return 0;
|
|
2129
|
+
}
|
|
2130
|
+
return Math.max(Math.round(size ** 2 / contentSize), minimumSliderSize);
|
|
2131
|
+
};
|
|
2132
|
+
const getScrollBarOffset$1 = (delta, finalDelta, size, scrollBarSize) => {
|
|
2133
|
+
const scrollBarOffset = delta / finalDelta * (size - scrollBarSize);
|
|
2134
|
+
return scrollBarOffset;
|
|
2135
|
+
};
|
|
2136
|
+
const getScrollBarY$1 = getScrollBarOffset$1;
|
|
2137
|
+
|
|
1999
2138
|
const emptyObject = {};
|
|
2000
2139
|
const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
|
|
2001
2140
|
const i18nString = (key, placeholders = emptyObject) => {
|
|
@@ -2018,6 +2157,10 @@ const ConfirmReplaceOneOccurrenceInOneFile = "Replace 1 occurrence across 1 file
|
|
|
2018
2157
|
const ConfirmReplaceOneOccurrenceInOneFileNoValue = 'Replace 1 occurrence across 1 file';
|
|
2019
2158
|
const CopyPath = 'Copy Path';
|
|
2020
2159
|
const Dismiss = 'Dismiss';
|
|
2160
|
+
const Cut = 'Cut';
|
|
2161
|
+
const Copy = 'Copy';
|
|
2162
|
+
const Paste = 'Paste';
|
|
2163
|
+
const SelectAll = 'SelectAll';
|
|
2021
2164
|
const Exclude = 'Exclude';
|
|
2022
2165
|
const FilesToExclude$1 = 'Files to Exclude';
|
|
2023
2166
|
const FilesToInclude$1 = 'Files to Include';
|
|
@@ -2144,6 +2287,18 @@ const replace = () => {
|
|
|
2144
2287
|
const dismiss = () => {
|
|
2145
2288
|
return i18nString(Dismiss);
|
|
2146
2289
|
};
|
|
2290
|
+
const cut = () => {
|
|
2291
|
+
return i18nString(Cut);
|
|
2292
|
+
};
|
|
2293
|
+
const copy = () => {
|
|
2294
|
+
return i18nString(Copy);
|
|
2295
|
+
};
|
|
2296
|
+
const paste = () => {
|
|
2297
|
+
return i18nString(Paste);
|
|
2298
|
+
};
|
|
2299
|
+
const selectAll = () => {
|
|
2300
|
+
return i18nString(SelectAll);
|
|
2301
|
+
};
|
|
2147
2302
|
const theResultSetOnlyContainsASubSetOfMatches = () => {
|
|
2148
2303
|
return i18nString(TheResultSetOnlyContainsASubSetOfMatches);
|
|
2149
2304
|
};
|
|
@@ -2206,27 +2361,13 @@ const getStatusMessage = (resultCount, fileResultCount) => {
|
|
|
2206
2361
|
return manyResultsInManyFiles(resultCount, fileResultCount);
|
|
2207
2362
|
};
|
|
2208
2363
|
|
|
2209
|
-
const
|
|
2210
|
-
if (maxLineY > newItemsLength) {
|
|
2211
|
-
const diff = maxLineY - minLineY;
|
|
2212
|
-
const newMinLineY = Math.max(newItemsLength - diff, 0);
|
|
2213
|
-
const newDeltaY = newMinLineY * itemHeight;
|
|
2214
|
-
return {
|
|
2215
|
-
newDeltaY,
|
|
2216
|
-
newMinLineY,
|
|
2217
|
-
newMaxLineY: newItemsLength
|
|
2218
|
-
};
|
|
2219
|
-
}
|
|
2220
|
-
return {
|
|
2221
|
-
newDeltaY: deltaY,
|
|
2222
|
-
newMinLineY: minLineY,
|
|
2223
|
-
newMaxLineY: maxLineY
|
|
2224
|
-
};
|
|
2225
|
-
};
|
|
2226
|
-
const dismissItem = state => {
|
|
2364
|
+
const removeIndex = async (state, index) => {
|
|
2227
2365
|
const {
|
|
2366
|
+
fileIconCache,
|
|
2367
|
+
minimumSliderSize,
|
|
2368
|
+
height,
|
|
2369
|
+
headerHeight,
|
|
2228
2370
|
items,
|
|
2229
|
-
listFocusedIndex,
|
|
2230
2371
|
fileCount,
|
|
2231
2372
|
matchCount,
|
|
2232
2373
|
minLineY,
|
|
@@ -2234,7 +2375,7 @@ const dismissItem = state => {
|
|
|
2234
2375
|
deltaY,
|
|
2235
2376
|
itemHeight
|
|
2236
2377
|
} = state;
|
|
2237
|
-
if (
|
|
2378
|
+
if (index === -1) {
|
|
2238
2379
|
return state;
|
|
2239
2380
|
}
|
|
2240
2381
|
const {
|
|
@@ -2242,26 +2383,50 @@ const dismissItem = state => {
|
|
|
2242
2383
|
newFocusedIndex,
|
|
2243
2384
|
newMatchCount,
|
|
2244
2385
|
newFileCount
|
|
2245
|
-
} = removeItemFromItems(items,
|
|
2386
|
+
} = removeItemFromItems(items, index, matchCount, fileCount);
|
|
2246
2387
|
const message = getStatusMessage(newMatchCount, newFileCount);
|
|
2247
2388
|
const {
|
|
2248
2389
|
newMinLineY,
|
|
2249
2390
|
newMaxLineY,
|
|
2250
2391
|
newDeltaY
|
|
2251
2392
|
} = getNewMinMax(newItems.length, minLineY, maxLineY, deltaY, itemHeight);
|
|
2393
|
+
const total = newItems.length;
|
|
2394
|
+
const contentHeight = total * itemHeight;
|
|
2395
|
+
const listHeight = height - headerHeight;
|
|
2396
|
+
const scrollBarHeight = getScrollBarSize$1(height, contentHeight, minimumSliderSize);
|
|
2397
|
+
const finalDeltaY = Math.max(contentHeight - listHeight, 0);
|
|
2398
|
+
const visible = newItems.slice(0, maxLineY);
|
|
2399
|
+
const {
|
|
2400
|
+
icons,
|
|
2401
|
+
newFileIconCache
|
|
2402
|
+
} = await getFileIcons(visible, fileIconCache);
|
|
2252
2403
|
return {
|
|
2253
2404
|
...state,
|
|
2405
|
+
deltaY: newDeltaY,
|
|
2406
|
+
fileCount: newFileCount,
|
|
2254
2407
|
items: newItems,
|
|
2408
|
+
listItems: newItems,
|
|
2255
2409
|
listFocusedIndex: newFocusedIndex,
|
|
2256
|
-
message,
|
|
2257
2410
|
matchCount: newMatchCount,
|
|
2258
|
-
fileCount: newFileCount,
|
|
2259
|
-
minLineY: newMinLineY,
|
|
2260
2411
|
maxLineY: newMaxLineY,
|
|
2261
|
-
|
|
2412
|
+
message,
|
|
2413
|
+
minLineY: newMinLineY,
|
|
2414
|
+
icons,
|
|
2415
|
+
fileIconCache: newFileIconCache,
|
|
2416
|
+
finalDeltaY,
|
|
2417
|
+
scrollBarHeight
|
|
2262
2418
|
};
|
|
2263
2419
|
};
|
|
2264
2420
|
|
|
2421
|
+
const dismissItem = state => {
|
|
2422
|
+
const {
|
|
2423
|
+
listFocusedIndex,
|
|
2424
|
+
focusedIndex
|
|
2425
|
+
} = state;
|
|
2426
|
+
const actualIndex = listFocusedIndex === -1 ? focusedIndex : listFocusedIndex;
|
|
2427
|
+
return removeIndex(state, actualIndex);
|
|
2428
|
+
};
|
|
2429
|
+
|
|
2265
2430
|
const expandDetails = state => {
|
|
2266
2431
|
const {
|
|
2267
2432
|
flags
|
|
@@ -2487,7 +2652,31 @@ const getKeyBindings = () => {
|
|
|
2487
2652
|
return [...getSearchHeaderKeyBindings(), ...getSearchResultKeyBindings()];
|
|
2488
2653
|
};
|
|
2489
2654
|
|
|
2490
|
-
const
|
|
2655
|
+
const getMenuEntriesInput = () => {
|
|
2656
|
+
return [{
|
|
2657
|
+
id: 'cut',
|
|
2658
|
+
label: cut(),
|
|
2659
|
+
flags: None$1,
|
|
2660
|
+
command: 'Search.cut'
|
|
2661
|
+
}, {
|
|
2662
|
+
id: 'copy',
|
|
2663
|
+
label: copy(),
|
|
2664
|
+
flags: None$1,
|
|
2665
|
+
command: 'Search.copy'
|
|
2666
|
+
}, {
|
|
2667
|
+
id: 'paste',
|
|
2668
|
+
label: paste(),
|
|
2669
|
+
flags: None$1,
|
|
2670
|
+
command: 'Search.paste'
|
|
2671
|
+
}, {
|
|
2672
|
+
id: 'selectAll',
|
|
2673
|
+
label: selectAll(),
|
|
2674
|
+
flags: None$1,
|
|
2675
|
+
command: 'Search.selectAll'
|
|
2676
|
+
}];
|
|
2677
|
+
};
|
|
2678
|
+
|
|
2679
|
+
const getMenuEntriesList = () => {
|
|
2491
2680
|
return [{
|
|
2492
2681
|
id: 'dismiss',
|
|
2493
2682
|
label: dismiss(),
|
|
@@ -2501,8 +2690,19 @@ const getMenuEntries = () => {
|
|
|
2501
2690
|
}];
|
|
2502
2691
|
};
|
|
2503
2692
|
|
|
2693
|
+
const getMenuEntries = (state, props) => {
|
|
2694
|
+
if (props.menuId === Search$1) {
|
|
2695
|
+
return getMenuEntriesList();
|
|
2696
|
+
}
|
|
2697
|
+
if (props.menuId === InputContextMenu$1) {
|
|
2698
|
+
return getMenuEntriesInput();
|
|
2699
|
+
}
|
|
2700
|
+
return [];
|
|
2701
|
+
};
|
|
2702
|
+
|
|
2703
|
+
const InputContextMenu = 91;
|
|
2504
2704
|
const getMenuEntryIds = () => {
|
|
2505
|
-
return [Search$1];
|
|
2705
|
+
return [Search$1, InputContextMenu];
|
|
2506
2706
|
};
|
|
2507
2707
|
|
|
2508
2708
|
const handleError = error => {
|
|
@@ -2545,114 +2745,6 @@ const handleUpdateError = async (state, update, error) => {
|
|
|
2545
2745
|
};
|
|
2546
2746
|
};
|
|
2547
2747
|
|
|
2548
|
-
const getFilePath = text => {
|
|
2549
|
-
// TODO make api stricter so that results always have the same shape
|
|
2550
|
-
if (text.startsWith('./')) {
|
|
2551
|
-
return text.slice(2);
|
|
2552
|
-
}
|
|
2553
|
-
return text;
|
|
2554
|
-
};
|
|
2555
|
-
|
|
2556
|
-
const getIconsCached = (dirents, fileIconCache) => {
|
|
2557
|
-
return dirents.map(dirent => {
|
|
2558
|
-
if (dirent.type === Match$1) {
|
|
2559
|
-
return '';
|
|
2560
|
-
}
|
|
2561
|
-
const path = getFilePath(dirent.text);
|
|
2562
|
-
return fileIconCache[path];
|
|
2563
|
-
});
|
|
2564
|
-
};
|
|
2565
|
-
|
|
2566
|
-
const getFileName = path => {
|
|
2567
|
-
const slashIndex = path.lastIndexOf('/');
|
|
2568
|
-
if (slashIndex === -1) {
|
|
2569
|
-
return path;
|
|
2570
|
-
}
|
|
2571
|
-
return path.slice(slashIndex + 1);
|
|
2572
|
-
};
|
|
2573
|
-
|
|
2574
|
-
const isFile = match => {
|
|
2575
|
-
return match.type === File;
|
|
2576
|
-
};
|
|
2577
|
-
|
|
2578
|
-
const getMissingDirents = (searchResults, fileIconCache) => {
|
|
2579
|
-
const missingDirents = [];
|
|
2580
|
-
const files = searchResults.filter(isFile);
|
|
2581
|
-
for (const file of files) {
|
|
2582
|
-
const uri = getFilePath(file.text);
|
|
2583
|
-
if (!(uri in fileIconCache)) {
|
|
2584
|
-
missingDirents.push(file);
|
|
2585
|
-
}
|
|
2586
|
-
}
|
|
2587
|
-
return missingDirents;
|
|
2588
|
-
};
|
|
2589
|
-
const toIconRequest = item => {
|
|
2590
|
-
const filePath = getFilePath(item.text);
|
|
2591
|
-
const fileName = getFileName(filePath);
|
|
2592
|
-
return {
|
|
2593
|
-
type: File$1,
|
|
2594
|
-
name: fileName,
|
|
2595
|
-
path: filePath
|
|
2596
|
-
};
|
|
2597
|
-
};
|
|
2598
|
-
const getMissingIconRequests = (dirents, fileIconCache) => {
|
|
2599
|
-
const missingRequests = getMissingDirents(dirents, fileIconCache);
|
|
2600
|
-
const iconRequests = missingRequests.map(toIconRequest);
|
|
2601
|
-
return iconRequests;
|
|
2602
|
-
};
|
|
2603
|
-
|
|
2604
|
-
const Directory = 3;
|
|
2605
|
-
const DirectoryExpanded = 4;
|
|
2606
|
-
|
|
2607
|
-
const getSimpleIconRequestType = direntType => {
|
|
2608
|
-
if (direntType === Directory || direntType === DirectoryExpanded) {
|
|
2609
|
-
return 2;
|
|
2610
|
-
}
|
|
2611
|
-
return 1;
|
|
2612
|
-
};
|
|
2613
|
-
|
|
2614
|
-
const toSimpleIconRequest = request => {
|
|
2615
|
-
return {
|
|
2616
|
-
name: request.name,
|
|
2617
|
-
type: getSimpleIconRequestType(request.type)
|
|
2618
|
-
};
|
|
2619
|
-
};
|
|
2620
|
-
|
|
2621
|
-
const requestFileIcons = async requests => {
|
|
2622
|
-
if (requests.length === 0) {
|
|
2623
|
-
return [];
|
|
2624
|
-
}
|
|
2625
|
-
const simpleRequests = requests.map(toSimpleIconRequest);
|
|
2626
|
-
const icons = await getIcons(simpleRequests);
|
|
2627
|
-
return icons;
|
|
2628
|
-
};
|
|
2629
|
-
|
|
2630
|
-
const updateIconCache = (iconCache, missingRequests, newIcons) => {
|
|
2631
|
-
if (missingRequests.length === 0) {
|
|
2632
|
-
return iconCache;
|
|
2633
|
-
}
|
|
2634
|
-
const newFileIconCache = {
|
|
2635
|
-
...iconCache
|
|
2636
|
-
};
|
|
2637
|
-
for (let i = 0; i < missingRequests.length; i++) {
|
|
2638
|
-
const request = missingRequests[i];
|
|
2639
|
-
const icon = newIcons[i];
|
|
2640
|
-
newFileIconCache[request.path] = icon;
|
|
2641
|
-
}
|
|
2642
|
-
return newFileIconCache;
|
|
2643
|
-
};
|
|
2644
|
-
|
|
2645
|
-
const getFileIcons = async (items, fileIconCache) => {
|
|
2646
|
-
const missingRequests = getMissingIconRequests(items, fileIconCache);
|
|
2647
|
-
const newIcons = await requestFileIcons(missingRequests);
|
|
2648
|
-
const newFileIconCache = updateIconCache(fileIconCache, missingRequests, newIcons);
|
|
2649
|
-
const icons = getIconsCached(items, newFileIconCache);
|
|
2650
|
-
return {
|
|
2651
|
-
icons,
|
|
2652
|
-
newFileIconCache
|
|
2653
|
-
};
|
|
2654
|
-
};
|
|
2655
|
-
|
|
2656
2748
|
// TODO optimize this function to return the minimum number
|
|
2657
2749
|
// of visible items needed, e.g. when not scrolled 5 items with
|
|
2658
2750
|
// 20px fill 100px but when scrolled 6 items are needed
|
|
@@ -2688,18 +2780,6 @@ const getTextSearchResultCounts = results => {
|
|
|
2688
2780
|
};
|
|
2689
2781
|
};
|
|
2690
2782
|
|
|
2691
|
-
const getScrollBarSize$1 = (size, contentSize, minimumSliderSize) => {
|
|
2692
|
-
if (size >= contentSize) {
|
|
2693
|
-
return 0;
|
|
2694
|
-
}
|
|
2695
|
-
return Math.max(Math.round(size ** 2 / contentSize), minimumSliderSize);
|
|
2696
|
-
};
|
|
2697
|
-
const getScrollBarOffset$1 = (delta, finalDelta, size, scrollBarSize) => {
|
|
2698
|
-
const scrollBarOffset = delta / finalDelta * (size - scrollBarSize);
|
|
2699
|
-
return scrollBarOffset;
|
|
2700
|
-
};
|
|
2701
|
-
const getScrollBarY$1 = getScrollBarOffset$1;
|
|
2702
|
-
|
|
2703
2783
|
const providers = Object.create(null);
|
|
2704
2784
|
const add = providerMap => {
|
|
2705
2785
|
Object.assign(providers, providerMap);
|
|
@@ -2752,7 +2832,7 @@ const handleUpdateFull = async (state, update) => {
|
|
|
2752
2832
|
useRegularExpression: Boolean(flags & UseRegularExpression$2),
|
|
2753
2833
|
exclude: excludeValue,
|
|
2754
2834
|
include: includeValue,
|
|
2755
|
-
assetDir
|
|
2835
|
+
assetDir,
|
|
2756
2836
|
root,
|
|
2757
2837
|
query: value,
|
|
2758
2838
|
scheme,
|
|
@@ -2780,9 +2860,6 @@ const handleUpdateFull = async (state, update) => {
|
|
|
2780
2860
|
icons,
|
|
2781
2861
|
newFileIconCache
|
|
2782
2862
|
} = await getFileIcons(visible, fileIconCache);
|
|
2783
|
-
|
|
2784
|
-
// TODO add info message if limit was hit
|
|
2785
|
-
|
|
2786
2863
|
const limitHitWarning = limitHit ? theResultSetOnlyContainsASubSetOfMatches() : '';
|
|
2787
2864
|
return {
|
|
2788
2865
|
...partialNewState,
|
|
@@ -3282,6 +3359,20 @@ const handleInputBlur = async (state, name) => {
|
|
|
3282
3359
|
return state;
|
|
3283
3360
|
};
|
|
3284
3361
|
|
|
3362
|
+
const show2 = async (uid, menuId, x, y, args) => {
|
|
3363
|
+
await showContextMenu2(uid, menuId, x, y, args);
|
|
3364
|
+
};
|
|
3365
|
+
|
|
3366
|
+
const handleInputContextMenu = async (state, button, x, y) => {
|
|
3367
|
+
const {
|
|
3368
|
+
uid
|
|
3369
|
+
} = state;
|
|
3370
|
+
await show2(uid, InputContextMenu$1, x, y, {
|
|
3371
|
+
menuId: InputContextMenu$1
|
|
3372
|
+
});
|
|
3373
|
+
return state;
|
|
3374
|
+
};
|
|
3375
|
+
|
|
3285
3376
|
const getSearchFocusKey = key => {
|
|
3286
3377
|
switch (key) {
|
|
3287
3378
|
case SearchValue:
|
|
@@ -3444,6 +3535,7 @@ const focusIndexScrollDown = (state, index, listHeight, itemHeight, itemsLength)
|
|
|
3444
3535
|
return {
|
|
3445
3536
|
...state,
|
|
3446
3537
|
focusedIndex: index,
|
|
3538
|
+
listFocusedIndex: index,
|
|
3447
3539
|
minLineY: newMinLineY,
|
|
3448
3540
|
maxLineY: newMaxLineY,
|
|
3449
3541
|
focused: true,
|
|
@@ -3466,6 +3558,7 @@ const focusIndexScrollUp = (state, index, listHeight, itemHeight, itemsLength) =
|
|
|
3466
3558
|
return {
|
|
3467
3559
|
...state,
|
|
3468
3560
|
focusedIndex: index,
|
|
3561
|
+
listFocusedIndex: index,
|
|
3469
3562
|
minLineY: newMinLineY,
|
|
3470
3563
|
maxLineY: newMaxLineY,
|
|
3471
3564
|
focused: true,
|
|
@@ -3491,6 +3584,7 @@ const focusIndex = (state, index) => {
|
|
|
3491
3584
|
return {
|
|
3492
3585
|
...state,
|
|
3493
3586
|
focusedIndex: -1,
|
|
3587
|
+
listFocusedIndex: -1,
|
|
3494
3588
|
focused: true
|
|
3495
3589
|
};
|
|
3496
3590
|
}
|
|
@@ -3504,6 +3598,7 @@ const focusIndex = (state, index) => {
|
|
|
3504
3598
|
return {
|
|
3505
3599
|
...state,
|
|
3506
3600
|
focusedIndex: index,
|
|
3601
|
+
listFocusedIndex: index,
|
|
3507
3602
|
focused: true
|
|
3508
3603
|
};
|
|
3509
3604
|
};
|
|
@@ -3740,7 +3835,7 @@ const toggleCollapsedPath = (collapsedPaths, path) => {
|
|
|
3740
3835
|
return [...collapsedPaths, path];
|
|
3741
3836
|
};
|
|
3742
3837
|
|
|
3743
|
-
const selectIndexFile = async (state, searchResult, index
|
|
3838
|
+
const selectIndexFile = async (state, searchResult, index) => {
|
|
3744
3839
|
const {
|
|
3745
3840
|
collapsedPaths,
|
|
3746
3841
|
items,
|
|
@@ -3799,7 +3894,7 @@ const getRelativePath = relativePath => {
|
|
|
3799
3894
|
return `/${relativePath}`; // TODO support windows paths
|
|
3800
3895
|
};
|
|
3801
3896
|
|
|
3802
|
-
const selectIndexPreview = async (state, searchResult, index
|
|
3897
|
+
const selectIndexPreview = async (state, searchResult, index) => {
|
|
3803
3898
|
const {
|
|
3804
3899
|
items,
|
|
3805
3900
|
workspacePath
|
|
@@ -3837,7 +3932,7 @@ const getSelectHandler = type => {
|
|
|
3837
3932
|
}
|
|
3838
3933
|
};
|
|
3839
3934
|
|
|
3840
|
-
const selectIndex = async (state, index
|
|
3935
|
+
const selectIndex = async (state, index) => {
|
|
3841
3936
|
if (index === -1) {
|
|
3842
3937
|
return {
|
|
3843
3938
|
...state,
|
|
@@ -3850,7 +3945,7 @@ const selectIndex = async (state, index, isRemoveButton = false) => {
|
|
|
3850
3945
|
} = state;
|
|
3851
3946
|
const searchResult = listItems[index];
|
|
3852
3947
|
const fn = getSelectHandler(searchResult.type);
|
|
3853
|
-
return fn(state, searchResult, index
|
|
3948
|
+
return fn(state, searchResult, index);
|
|
3854
3949
|
};
|
|
3855
3950
|
|
|
3856
3951
|
const handleClickAt = async (state, eventX, eventY, name) => {
|
|
@@ -3865,7 +3960,10 @@ const handleClickAt = async (state, eventX, eventY, name) => {
|
|
|
3865
3960
|
const topHeight = getTopHeight(flags);
|
|
3866
3961
|
const index = getListIndex(eventX, eventY, x, y, deltaY, itemHeight, topHeight, listItems.length);
|
|
3867
3962
|
const isRemoveButton = name === Remove;
|
|
3868
|
-
|
|
3963
|
+
if (isRemoveButton) {
|
|
3964
|
+
return removeIndex(state, index);
|
|
3965
|
+
}
|
|
3966
|
+
return selectIndex(state, index);
|
|
3869
3967
|
};
|
|
3870
3968
|
|
|
3871
3969
|
const handleListPointerDown = async (state, button) => {
|
|
@@ -4045,13 +4143,6 @@ const removeCurrent = async state => {
|
|
|
4045
4143
|
};
|
|
4046
4144
|
};
|
|
4047
4145
|
|
|
4048
|
-
const removeIndex = async (state, searchResult, index) => {
|
|
4049
|
-
// TODO
|
|
4050
|
-
return {
|
|
4051
|
-
...state
|
|
4052
|
-
};
|
|
4053
|
-
};
|
|
4054
|
-
|
|
4055
4146
|
const getFocusSelector = focusKey => {
|
|
4056
4147
|
switch (focusKey) {
|
|
4057
4148
|
case FocusSearchInput:
|
|
@@ -4249,6 +4340,7 @@ const HandleWheel = 16;
|
|
|
4249
4340
|
const HandleInputFocus = 17;
|
|
4250
4341
|
const HandleInputBlur = 18;
|
|
4251
4342
|
const HandleListPointerDown = 19;
|
|
4343
|
+
const HandleInputContextMenu = 20;
|
|
4252
4344
|
|
|
4253
4345
|
const getSearchDetailsToggleVirtualDom = () => {
|
|
4254
4346
|
return [{
|
|
@@ -4428,7 +4520,7 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
|
|
|
4428
4520
|
onInput,
|
|
4429
4521
|
onFocus: HandleInputFocus,
|
|
4430
4522
|
onBlur: HandleInputBlur,
|
|
4431
|
-
onContextMenu:
|
|
4523
|
+
onContextMenu: HandleInputContextMenu,
|
|
4432
4524
|
childCount: 0
|
|
4433
4525
|
}, {
|
|
4434
4526
|
type: Div,
|
|
@@ -5036,6 +5128,10 @@ const renderEventListeners = () => {
|
|
|
5036
5128
|
name: HandleListContextMenu,
|
|
5037
5129
|
params: ['handleContextMenu', Button$1, ClientX, ClientY],
|
|
5038
5130
|
preventDefault: true
|
|
5131
|
+
}, {
|
|
5132
|
+
name: HandleInputContextMenu,
|
|
5133
|
+
params: ['handleInputContextMenu', Button$1, ClientX, ClientY],
|
|
5134
|
+
preventDefault: true
|
|
5039
5135
|
}, {
|
|
5040
5136
|
name: HandleHeaderContextMenu,
|
|
5041
5137
|
params: ['handleHeaderContextMenu'],
|
|
@@ -5248,10 +5344,6 @@ const viewAsTree = async state => {
|
|
|
5248
5344
|
|
|
5249
5345
|
const Keyboard = -1;
|
|
5250
5346
|
|
|
5251
|
-
const show2 = async (uid, menuId, x, y, args) => {
|
|
5252
|
-
await showContextMenu2(uid, menuId, x, y, args);
|
|
5253
|
-
};
|
|
5254
|
-
|
|
5255
5347
|
const handleContextMenuKeyboard = async state => {
|
|
5256
5348
|
const {
|
|
5257
5349
|
x,
|
|
@@ -5293,8 +5385,7 @@ const commandMap = {
|
|
|
5293
5385
|
'TextSearch.clearSearchResults': wrapCommand(clearSearchResults$1),
|
|
5294
5386
|
'TextSearch.collapseAll': wrapCommand(collapseAll$1),
|
|
5295
5387
|
'TextSearch.collapseDetails': wrapCommand(collapseDetails),
|
|
5296
|
-
'TextSearch.
|
|
5297
|
-
'TextSearch.copy': wrapCommand(copy),
|
|
5388
|
+
'TextSearch.copy': wrapCommand(copy$1),
|
|
5298
5389
|
'TextSearch.copyPath': wrapCommand(copyPath$1),
|
|
5299
5390
|
'TextSearch.diff2': diff2,
|
|
5300
5391
|
'TextSearch.dismissItem': wrapCommand(dismissItem),
|
|
@@ -5312,6 +5403,7 @@ const commandMap = {
|
|
|
5312
5403
|
'TextSearch.focusPreserveCasePrevious': wrapCommand(focusPreserveCasePrevious),
|
|
5313
5404
|
'TextSearch.focusPrevious': wrapCommand(focusPrevious),
|
|
5314
5405
|
'TextSearch.focusPreviousInput': wrapCommand(focusPreviousInput),
|
|
5406
|
+
'TextSearch.handleInputContextMenu': wrapCommand(handleInputContextMenu),
|
|
5315
5407
|
'TextSearch.focusPreviousPage': wrapCommand(focusPreviousPage),
|
|
5316
5408
|
'TextSearch.focusRegex': wrapCommand(focusRegex),
|
|
5317
5409
|
'TextSearch.focusRegexNext': wrapCommand(focusRegexNext),
|
|
@@ -5348,6 +5440,7 @@ const commandMap = {
|
|
|
5348
5440
|
'TextSearch.nextHistoryResult': wrapCommand(nextHistoryResult),
|
|
5349
5441
|
'TextSearch.previousHistoryResult': wrapCommand(previousHistoryResult),
|
|
5350
5442
|
'TextSearch.refresh': wrapCommand(refresh),
|
|
5443
|
+
'TextSearch.removeCurrent': wrapCommand(removeCurrent),
|
|
5351
5444
|
'TextSearch.removeIndex': wrapCommand(removeIndex),
|
|
5352
5445
|
'TextSearch.replaceAll': wrapCommand(replaceAll),
|
|
5353
5446
|
'TextSearch.rerender': rerender,
|
|
@@ -5363,6 +5456,7 @@ const commandMap = {
|
|
|
5363
5456
|
'TextSearch.toggleUseIgnoreFiles': wrapCommand(toggleUseIgnoreFiles),
|
|
5364
5457
|
'TextSearch.toggleUseRegularExpression': wrapCommand(toggleUseRegularExpression),
|
|
5365
5458
|
'TextSearch.viewAsTree': wrapCommand(viewAsTree),
|
|
5459
|
+
'TextSearch.getMenuEntries': wrapGetter(getMenuEntries),
|
|
5366
5460
|
// not wrapped
|
|
5367
5461
|
'TextSearch.initialize': initialize,
|
|
5368
5462
|
'TextSearch.create': create,
|
|
@@ -5376,7 +5470,6 @@ const commandMap = {
|
|
|
5376
5470
|
'TextSearch.terminate': terminate,
|
|
5377
5471
|
'TextSearch.renderActions': renderActions,
|
|
5378
5472
|
'TextSearch.getMenuEntryIds': getMenuEntryIds,
|
|
5379
|
-
'TextSearch.getMenuEntries': getMenuEntries,
|
|
5380
5473
|
// TODO needed?
|
|
5381
5474
|
'TextSearch.replaceAllAndPrompt': replaceAllAndPrompt,
|
|
5382
5475
|
'TextSearch.textSearch': textSearch$6
|