@lvce-editor/text-search-worker 5.32.0 → 5.33.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/dist/textSearchWorkerMain.js +692 -690
- package/package.json +1 -1
|
@@ -1327,6 +1327,9 @@ const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
|
|
|
1327
1327
|
// @ts-ignore
|
|
1328
1328
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
|
|
1329
1329
|
};
|
|
1330
|
+
const handleWorkspaceRefresh = async () => {
|
|
1331
|
+
return invoke$1('Layout.handleWorkspaceRefresh');
|
|
1332
|
+
};
|
|
1330
1333
|
const sendMessagePortToSearchProcess = async port => {
|
|
1331
1334
|
await invokeAndTransfer('SendMessagePortToElectron.sendMessagePortToElectron', port, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
|
|
1332
1335
|
};
|
|
@@ -1684,10 +1687,13 @@ const clearSearchResults$1 = state => {
|
|
|
1684
1687
|
focusSource: Script,
|
|
1685
1688
|
inputSource: Script,
|
|
1686
1689
|
items: [],
|
|
1690
|
+
limitHit: false,
|
|
1691
|
+
limitHitWarning: '',
|
|
1687
1692
|
maxLineY: 0,
|
|
1688
1693
|
message: '',
|
|
1689
1694
|
minLineY: 0,
|
|
1690
1695
|
replacement: '',
|
|
1696
|
+
searchInputErrorMessage: '',
|
|
1691
1697
|
value: ''
|
|
1692
1698
|
};
|
|
1693
1699
|
};
|
|
@@ -1747,8 +1753,8 @@ const collapseDetails = state => {
|
|
|
1747
1753
|
|
|
1748
1754
|
const copy$1 = async state => {
|
|
1749
1755
|
const {
|
|
1750
|
-
|
|
1751
|
-
|
|
1756
|
+
focusedIndex,
|
|
1757
|
+
items
|
|
1752
1758
|
} = state;
|
|
1753
1759
|
if (focusedIndex === -1) {
|
|
1754
1760
|
return state;
|
|
@@ -1760,8 +1766,8 @@ const copy$1 = async state => {
|
|
|
1760
1766
|
|
|
1761
1767
|
const copyPath$1 = async state => {
|
|
1762
1768
|
const {
|
|
1763
|
-
items,
|
|
1764
1769
|
focusedIndex,
|
|
1770
|
+
items,
|
|
1765
1771
|
listFocusedIndex
|
|
1766
1772
|
} = state;
|
|
1767
1773
|
const actualIndex = focusedIndex === -1 ? listFocusedIndex : focusedIndex;
|
|
@@ -1777,111 +1783,112 @@ const minimumSliderSize = 20;
|
|
|
1777
1783
|
|
|
1778
1784
|
const {
|
|
1779
1785
|
get: get$1,
|
|
1786
|
+
getCommandIds,
|
|
1787
|
+
registerCommands,
|
|
1780
1788
|
set,
|
|
1781
1789
|
wrapCommand,
|
|
1782
|
-
registerCommands,
|
|
1783
|
-
getCommandIds,
|
|
1784
1790
|
wrapGetter
|
|
1785
1791
|
} = create$2();
|
|
1786
1792
|
|
|
1787
1793
|
const List = 1;
|
|
1788
1794
|
|
|
1789
1795
|
const create$1 = ({
|
|
1790
|
-
itemHeight,
|
|
1791
1796
|
headerHeight = 0,
|
|
1797
|
+
itemHeight,
|
|
1792
1798
|
minimumSliderSize = 20
|
|
1793
1799
|
}) => {
|
|
1794
1800
|
return {
|
|
1795
1801
|
deltaY: 0,
|
|
1796
|
-
minLineY: 0,
|
|
1797
|
-
maxLineY: 0,
|
|
1798
1802
|
finalDeltaY: 0,
|
|
1799
|
-
|
|
1803
|
+
focusedIndex: -1,
|
|
1800
1804
|
headerHeight,
|
|
1805
|
+
itemHeight,
|
|
1801
1806
|
items: [],
|
|
1802
1807
|
listItems: [],
|
|
1808
|
+
maxLineY: 0,
|
|
1803
1809
|
minimumSliderSize,
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
touchTimeStamp: 0,
|
|
1807
|
-
touchDifference: 0,
|
|
1810
|
+
minLineY: 0,
|
|
1811
|
+
scrollBarActive: false,
|
|
1808
1812
|
scrollBarHeight: 0,
|
|
1809
|
-
|
|
1813
|
+
touchDifference: 0,
|
|
1814
|
+
touchOffsetY: 0,
|
|
1815
|
+
touchTimeStamp: 0
|
|
1810
1816
|
};
|
|
1811
1817
|
};
|
|
1812
1818
|
|
|
1813
1819
|
const create = (uid, x, y, width, height, workspacePath, assetDir, itemHeight, value = '', replacement = '', platform) => {
|
|
1814
1820
|
const state = {
|
|
1815
|
-
|
|
1821
|
+
disposed: false,
|
|
1822
|
+
fileCount: 0,
|
|
1823
|
+
height,
|
|
1816
1824
|
searchResults: [],
|
|
1817
1825
|
stats: {},
|
|
1826
|
+
uid,
|
|
1818
1827
|
value,
|
|
1819
|
-
|
|
1820
|
-
fileCount: 0,
|
|
1828
|
+
width,
|
|
1821
1829
|
x,
|
|
1822
1830
|
y,
|
|
1823
|
-
width,
|
|
1824
|
-
height,
|
|
1825
1831
|
...create$1({
|
|
1832
|
+
headerHeight: 61,
|
|
1833
|
+
// TODO
|
|
1826
1834
|
itemHeight: itemHeight || 22,
|
|
1827
|
-
minimumSliderSize: minimumSliderSize
|
|
1828
|
-
headerHeight: 61 // TODO
|
|
1835
|
+
minimumSliderSize: minimumSliderSize
|
|
1829
1836
|
}),
|
|
1830
|
-
threads: 0,
|
|
1831
|
-
replacement,
|
|
1832
|
-
matchCount: 0,
|
|
1833
|
-
listFocused: false,
|
|
1834
|
-
listFocusedIndex: -1,
|
|
1835
|
-
inputSource: User,
|
|
1836
|
-
workspacePath: workspacePath,
|
|
1837
|
-
includeValue: '',
|
|
1838
|
-
excludeValue: '',
|
|
1839
|
-
focus: Empty,
|
|
1840
|
-
loaded: false,
|
|
1841
|
-
message: '',
|
|
1842
|
-
collapsedPaths: [],
|
|
1843
|
-
icons: [],
|
|
1844
1837
|
assetDir,
|
|
1838
|
+
collapsedPaths: [],
|
|
1845
1839
|
deltaY: 0,
|
|
1840
|
+
excludeValue: '',
|
|
1841
|
+
fileIconCache: {},
|
|
1846
1842
|
finalDeltaY: 0,
|
|
1843
|
+
flags: 0,
|
|
1844
|
+
focus: Empty,
|
|
1847
1845
|
focused: false,
|
|
1848
1846
|
focusedIndex: -1,
|
|
1849
|
-
handleOffset: 0,
|
|
1850
1847
|
focusSource: User,
|
|
1851
|
-
|
|
1852
|
-
platform,
|
|
1853
|
-
searchInputErrorMessage: '',
|
|
1848
|
+
handleOffset: 0,
|
|
1854
1849
|
history: [],
|
|
1855
1850
|
historyIndex: -1,
|
|
1856
|
-
|
|
1851
|
+
icons: [],
|
|
1852
|
+
includeValue: '',
|
|
1857
1853
|
incrementalSearch: false,
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
useFileIcons: true,
|
|
1854
|
+
inputSource: User,
|
|
1855
|
+
limit: 20_000,
|
|
1861
1856
|
limitHit: false,
|
|
1862
1857
|
limitHitWarning: '',
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1858
|
+
listFocused: false,
|
|
1859
|
+
listFocusedIndex: -1,
|
|
1860
|
+
loaded: false,
|
|
1861
|
+
matchCount: 0,
|
|
1862
|
+
message: '',
|
|
1863
|
+
platform,
|
|
1866
1864
|
removeButtonRight: 0,
|
|
1865
|
+
removeButtonWidth: 20,
|
|
1866
|
+
replacement,
|
|
1867
|
+
searchId: '',
|
|
1868
|
+
searchInputErrorMessage: '',
|
|
1867
1869
|
selections: {
|
|
1868
|
-
SearchValue: {
|
|
1869
|
-
start: 0,
|
|
1870
|
-
end: 0
|
|
1871
|
-
},
|
|
1872
|
-
ReplaceValue: {
|
|
1873
|
-
start: 0,
|
|
1874
|
-
end: 0
|
|
1875
|
-
},
|
|
1876
1870
|
FilesToExclude: {
|
|
1877
|
-
|
|
1878
|
-
|
|
1871
|
+
end: 0,
|
|
1872
|
+
start: 0
|
|
1879
1873
|
},
|
|
1880
1874
|
FilesToInclude: {
|
|
1881
|
-
|
|
1882
|
-
|
|
1875
|
+
end: 0,
|
|
1876
|
+
start: 0
|
|
1877
|
+
},
|
|
1878
|
+
ReplaceValue: {
|
|
1879
|
+
end: 0,
|
|
1880
|
+
start: 0
|
|
1881
|
+
},
|
|
1882
|
+
SearchValue: {
|
|
1883
|
+
end: 0,
|
|
1884
|
+
start: 0
|
|
1883
1885
|
}
|
|
1884
|
-
}
|
|
1886
|
+
},
|
|
1887
|
+
threads: 0,
|
|
1888
|
+
useChevrons: true,
|
|
1889
|
+
useFileIcons: true,
|
|
1890
|
+
viewMode: List,
|
|
1891
|
+
workspacePath: workspacePath
|
|
1885
1892
|
};
|
|
1886
1893
|
set(uid, state, state);
|
|
1887
1894
|
return state;
|
|
@@ -1946,8 +1953,8 @@ const diff = (oldState, newState) => {
|
|
|
1946
1953
|
|
|
1947
1954
|
const diff2 = uid => {
|
|
1948
1955
|
const {
|
|
1949
|
-
|
|
1950
|
-
|
|
1956
|
+
newState,
|
|
1957
|
+
oldState
|
|
1951
1958
|
} = get$1(uid);
|
|
1952
1959
|
const diffResult = diff(oldState, newState);
|
|
1953
1960
|
return diffResult;
|
|
@@ -1998,9 +2005,9 @@ const toIconRequest = item => {
|
|
|
1998
2005
|
const filePath = getFilePath(item.text);
|
|
1999
2006
|
const fileName = getFileName(filePath);
|
|
2000
2007
|
return {
|
|
2001
|
-
type: File$2,
|
|
2002
2008
|
name: fileName,
|
|
2003
|
-
path: filePath
|
|
2009
|
+
path: filePath,
|
|
2010
|
+
type: File$2
|
|
2004
2011
|
};
|
|
2005
2012
|
};
|
|
2006
2013
|
const getMissingIconRequests = (dirents, fileIconCache) => {
|
|
@@ -2068,14 +2075,14 @@ const getNewMinMax = (newItemsLength, minLineY, maxLineY, deltaY, itemHeight) =>
|
|
|
2068
2075
|
const newDeltaY = newMinLineY * itemHeight;
|
|
2069
2076
|
return {
|
|
2070
2077
|
newDeltaY,
|
|
2071
|
-
|
|
2072
|
-
|
|
2078
|
+
newMaxLineY: newItemsLength,
|
|
2079
|
+
newMinLineY
|
|
2073
2080
|
};
|
|
2074
2081
|
}
|
|
2075
2082
|
return {
|
|
2076
2083
|
newDeltaY: deltaY,
|
|
2077
|
-
|
|
2078
|
-
|
|
2084
|
+
newMaxLineY: maxLineY,
|
|
2085
|
+
newMinLineY: minLineY
|
|
2079
2086
|
};
|
|
2080
2087
|
};
|
|
2081
2088
|
|
|
@@ -2098,11 +2105,11 @@ const getSetSize = (items, index) => {
|
|
|
2098
2105
|
const getRemoveIndicesFile = (items, item, index, matchCount, fileCount) => {
|
|
2099
2106
|
const setSize = getSetSize(items, index);
|
|
2100
2107
|
return {
|
|
2101
|
-
startIndex: index,
|
|
2102
|
-
removeCount: setSize + 1,
|
|
2103
|
-
newFocusedIndex: index + setSize + 1 < items.length ? index : index - 1,
|
|
2104
2108
|
newFileCount: fileCount - 1,
|
|
2105
|
-
|
|
2109
|
+
newFocusedIndex: index + setSize + 1 < items.length ? index : index - 1,
|
|
2110
|
+
newMatchCount: matchCount - setSize,
|
|
2111
|
+
removeCount: setSize + 1,
|
|
2112
|
+
startIndex: index
|
|
2106
2113
|
};
|
|
2107
2114
|
};
|
|
2108
2115
|
const getRemoveIndicesMatch = (items, index, matchCount, fileCount) => {
|
|
@@ -2111,19 +2118,19 @@ const getRemoveIndicesMatch = (items, index, matchCount, fileCount) => {
|
|
|
2111
2118
|
const setSize = getSetSize(items, i);
|
|
2112
2119
|
if (setSize === 1) {
|
|
2113
2120
|
return {
|
|
2114
|
-
startIndex: i,
|
|
2115
|
-
removeCount: 2,
|
|
2116
|
-
newFocusedIndex: i - 1,
|
|
2117
2121
|
newFileCount: fileCount - 1,
|
|
2118
|
-
|
|
2122
|
+
newFocusedIndex: i - 1,
|
|
2123
|
+
newMatchCount: matchCount - 1,
|
|
2124
|
+
removeCount: 2,
|
|
2125
|
+
startIndex: i
|
|
2119
2126
|
};
|
|
2120
2127
|
}
|
|
2121
2128
|
return {
|
|
2122
|
-
startIndex: index,
|
|
2123
|
-
removeCount: 1,
|
|
2124
|
-
newFocusedIndex: index,
|
|
2125
2129
|
newFileCount: fileCount,
|
|
2126
|
-
|
|
2130
|
+
newFocusedIndex: index,
|
|
2131
|
+
newMatchCount: matchCount - 1,
|
|
2132
|
+
removeCount: 1,
|
|
2133
|
+
startIndex: index
|
|
2127
2134
|
};
|
|
2128
2135
|
}
|
|
2129
2136
|
}
|
|
@@ -2142,17 +2149,17 @@ const getRemoveIndices = (items, index, matchCount, fileCount) => {
|
|
|
2142
2149
|
};
|
|
2143
2150
|
const removeItemFromItems = (items, index, matchCount, fileCount) => {
|
|
2144
2151
|
const {
|
|
2145
|
-
startIndex,
|
|
2146
|
-
removeCount,
|
|
2147
|
-
newFocusedIndex,
|
|
2148
2152
|
newFileCount,
|
|
2149
|
-
|
|
2153
|
+
newFocusedIndex,
|
|
2154
|
+
newMatchCount,
|
|
2155
|
+
removeCount,
|
|
2156
|
+
startIndex
|
|
2150
2157
|
} = getRemoveIndices(items, index, matchCount, fileCount);
|
|
2151
2158
|
const newItems = remove$1(items, startIndex, removeCount);
|
|
2152
2159
|
return {
|
|
2153
|
-
newItems,
|
|
2154
|
-
newFocusedIndex,
|
|
2155
2160
|
newFileCount,
|
|
2161
|
+
newFocusedIndex,
|
|
2162
|
+
newItems,
|
|
2156
2163
|
newMatchCount
|
|
2157
2164
|
};
|
|
2158
2165
|
};
|
|
@@ -2401,32 +2408,32 @@ const getStatusMessage = (resultCount, fileResultCount) => {
|
|
|
2401
2408
|
|
|
2402
2409
|
const removeIndex = async (state, index) => {
|
|
2403
2410
|
const {
|
|
2411
|
+
deltaY,
|
|
2412
|
+
fileCount,
|
|
2404
2413
|
fileIconCache,
|
|
2405
|
-
minimumSliderSize,
|
|
2406
|
-
height,
|
|
2407
2414
|
headerHeight,
|
|
2415
|
+
height,
|
|
2416
|
+
itemHeight,
|
|
2408
2417
|
items,
|
|
2409
|
-
fileCount,
|
|
2410
2418
|
matchCount,
|
|
2411
|
-
minLineY,
|
|
2412
2419
|
maxLineY,
|
|
2413
|
-
|
|
2414
|
-
|
|
2420
|
+
minimumSliderSize,
|
|
2421
|
+
minLineY
|
|
2415
2422
|
} = state;
|
|
2416
2423
|
if (index === -1) {
|
|
2417
2424
|
return state;
|
|
2418
2425
|
}
|
|
2419
2426
|
const {
|
|
2420
|
-
|
|
2427
|
+
newFileCount,
|
|
2421
2428
|
newFocusedIndex,
|
|
2422
|
-
|
|
2423
|
-
|
|
2429
|
+
newItems,
|
|
2430
|
+
newMatchCount
|
|
2424
2431
|
} = removeItemFromItems(items, index, matchCount, fileCount);
|
|
2425
2432
|
const message = getStatusMessage(newMatchCount, newFileCount);
|
|
2426
2433
|
const {
|
|
2427
|
-
|
|
2434
|
+
newDeltaY,
|
|
2428
2435
|
newMaxLineY,
|
|
2429
|
-
|
|
2436
|
+
newMinLineY
|
|
2430
2437
|
} = getNewMinMax(newItems.length, minLineY, maxLineY, deltaY, itemHeight);
|
|
2431
2438
|
const total = newItems.length;
|
|
2432
2439
|
const contentHeight = total * itemHeight;
|
|
@@ -2442,24 +2449,24 @@ const removeIndex = async (state, index) => {
|
|
|
2442
2449
|
...state,
|
|
2443
2450
|
deltaY: newDeltaY,
|
|
2444
2451
|
fileCount: newFileCount,
|
|
2452
|
+
fileIconCache: newFileIconCache,
|
|
2453
|
+
finalDeltaY,
|
|
2454
|
+
icons,
|
|
2445
2455
|
items: newItems,
|
|
2446
|
-
listItems: newItems,
|
|
2447
2456
|
listFocusedIndex: newFocusedIndex,
|
|
2457
|
+
listItems: newItems,
|
|
2448
2458
|
matchCount: newMatchCount,
|
|
2449
2459
|
maxLineY: newMaxLineY,
|
|
2450
2460
|
message,
|
|
2451
2461
|
minLineY: newMinLineY,
|
|
2452
|
-
icons,
|
|
2453
|
-
fileIconCache: newFileIconCache,
|
|
2454
|
-
finalDeltaY,
|
|
2455
2462
|
scrollBarHeight
|
|
2456
2463
|
};
|
|
2457
2464
|
};
|
|
2458
2465
|
|
|
2459
2466
|
const dismissItem = state => {
|
|
2460
2467
|
const {
|
|
2461
|
-
|
|
2462
|
-
|
|
2468
|
+
focusedIndex,
|
|
2469
|
+
listFocusedIndex
|
|
2463
2470
|
} = state;
|
|
2464
2471
|
const actualIndex = listFocusedIndex === -1 ? focusedIndex : listFocusedIndex;
|
|
2465
2472
|
return removeIndex(state, actualIndex);
|
|
@@ -2486,8 +2493,12 @@ const focusMatchCase$1 = state => {
|
|
|
2486
2493
|
|
|
2487
2494
|
const getNextFocus = (focus, flags) => {
|
|
2488
2495
|
switch (focus) {
|
|
2489
|
-
case
|
|
2490
|
-
return
|
|
2496
|
+
case FocusIgnoreFiles:
|
|
2497
|
+
return FocusSearchResults;
|
|
2498
|
+
case FocusSearchExcludeInput:
|
|
2499
|
+
return FocusIgnoreFiles;
|
|
2500
|
+
case FocusSearchIncludeInput:
|
|
2501
|
+
return FocusSearchOpenEditors;
|
|
2491
2502
|
case FocusSearchInput:
|
|
2492
2503
|
if (flags & ReplaceExpanded) {
|
|
2493
2504
|
return FocusSearchReplaceInput;
|
|
@@ -2495,32 +2506,28 @@ const getNextFocus = (focus, flags) => {
|
|
|
2495
2506
|
return FocusSearchMatchCase;
|
|
2496
2507
|
case FocusSearchMatchCase:
|
|
2497
2508
|
return FocusSearchWholeWord;
|
|
2498
|
-
case
|
|
2499
|
-
return
|
|
2509
|
+
case FocusSearchOpenEditors:
|
|
2510
|
+
return FocusSearchExcludeInput;
|
|
2511
|
+
case FocusSearchPreserveCase:
|
|
2512
|
+
return FocusSearchReplaceAll;
|
|
2500
2513
|
case FocusSearchRegex:
|
|
2501
2514
|
if (flags & ReplaceExpanded) {
|
|
2502
2515
|
return FocusSearchPreserveCase;
|
|
2503
2516
|
}
|
|
2504
2517
|
return FocusToggleDetails;
|
|
2505
|
-
case FocusSearchReplaceInput:
|
|
2506
|
-
return FocusSearchMatchCase;
|
|
2507
|
-
case FocusSearchPreserveCase:
|
|
2508
|
-
return FocusSearchReplaceAll;
|
|
2509
2518
|
case FocusSearchReplaceAll:
|
|
2510
2519
|
return FocusToggleDetails;
|
|
2511
|
-
case
|
|
2512
|
-
return
|
|
2513
|
-
case
|
|
2514
|
-
return
|
|
2515
|
-
case FocusSearchExcludeInput:
|
|
2516
|
-
return FocusIgnoreFiles;
|
|
2520
|
+
case FocusSearchReplaceInput:
|
|
2521
|
+
return FocusSearchMatchCase;
|
|
2522
|
+
case FocusSearchWholeWord:
|
|
2523
|
+
return FocusSearchRegex;
|
|
2517
2524
|
case FocusToggleDetails:
|
|
2518
2525
|
if (flags & DetailsExpanded) {
|
|
2519
2526
|
return FocusSearchIncludeInput;
|
|
2520
2527
|
}
|
|
2521
2528
|
return FocusSearchResults;
|
|
2522
|
-
case
|
|
2523
|
-
return
|
|
2529
|
+
case FocusToggleReplace:
|
|
2530
|
+
return FocusSearchInput;
|
|
2524
2531
|
default:
|
|
2525
2532
|
return focus;
|
|
2526
2533
|
}
|
|
@@ -2528,8 +2535,8 @@ const getNextFocus = (focus, flags) => {
|
|
|
2528
2535
|
|
|
2529
2536
|
const focusNextInput = state => {
|
|
2530
2537
|
const {
|
|
2531
|
-
|
|
2532
|
-
|
|
2538
|
+
flags,
|
|
2539
|
+
focus
|
|
2533
2540
|
} = state;
|
|
2534
2541
|
const nextFocus = getNextFocus(focus, flags);
|
|
2535
2542
|
const isListFocus = nextFocus === FocusSearchResults;
|
|
@@ -2543,6 +2550,12 @@ const focusNextInput = state => {
|
|
|
2543
2550
|
|
|
2544
2551
|
const getPreviousFocus = (focus, flags) => {
|
|
2545
2552
|
switch (focus) {
|
|
2553
|
+
case FocusIgnoreFiles:
|
|
2554
|
+
return FocusSearchExcludeInput;
|
|
2555
|
+
case FocusSearchExcludeInput:
|
|
2556
|
+
return FocusSearchOpenEditors;
|
|
2557
|
+
case FocusSearchIncludeInput:
|
|
2558
|
+
return FocusToggleDetails;
|
|
2546
2559
|
case FocusSearchInput:
|
|
2547
2560
|
return FocusToggleReplace;
|
|
2548
2561
|
case FocusSearchMatchCase:
|
|
@@ -2550,29 +2563,23 @@ const getPreviousFocus = (focus, flags) => {
|
|
|
2550
2563
|
return FocusSearchReplaceInput;
|
|
2551
2564
|
}
|
|
2552
2565
|
return FocusSearchInput;
|
|
2553
|
-
case
|
|
2554
|
-
return
|
|
2555
|
-
case FocusSearchRegex:
|
|
2556
|
-
return FocusSearchWholeWord;
|
|
2566
|
+
case FocusSearchOpenEditors:
|
|
2567
|
+
return FocusSearchIncludeInput;
|
|
2557
2568
|
case FocusSearchPreserveCase:
|
|
2558
2569
|
return FocusSearchRegex;
|
|
2559
|
-
case
|
|
2560
|
-
return
|
|
2570
|
+
case FocusSearchRegex:
|
|
2571
|
+
return FocusSearchWholeWord;
|
|
2561
2572
|
case FocusSearchReplaceAll:
|
|
2562
2573
|
return FocusSearchPreserveCase;
|
|
2574
|
+
case FocusSearchReplaceInput:
|
|
2575
|
+
return FocusSearchInput;
|
|
2576
|
+
case FocusSearchWholeWord:
|
|
2577
|
+
return FocusSearchMatchCase;
|
|
2563
2578
|
case FocusToggleDetails:
|
|
2564
2579
|
if (flags & ReplaceExpanded) {
|
|
2565
2580
|
return FocusSearchReplaceAll;
|
|
2566
2581
|
}
|
|
2567
2582
|
return FocusSearchRegex;
|
|
2568
|
-
case FocusSearchOpenEditors:
|
|
2569
|
-
return FocusSearchIncludeInput;
|
|
2570
|
-
case FocusSearchExcludeInput:
|
|
2571
|
-
return FocusSearchOpenEditors;
|
|
2572
|
-
case FocusIgnoreFiles:
|
|
2573
|
-
return FocusSearchExcludeInput;
|
|
2574
|
-
case FocusSearchIncludeInput:
|
|
2575
|
-
return FocusToggleDetails;
|
|
2576
2583
|
default:
|
|
2577
2584
|
return focus;
|
|
2578
2585
|
}
|
|
@@ -2624,64 +2631,64 @@ const Alt = 1 << 9 >>> 0;
|
|
|
2624
2631
|
|
|
2625
2632
|
const getSearchHeaderKeyBindings = () => {
|
|
2626
2633
|
return [{
|
|
2627
|
-
key: CtrlCmd | Alt | Enter,
|
|
2628
2634
|
command: 'Search.replaceAll',
|
|
2635
|
+
key: CtrlCmd | Alt | Enter,
|
|
2629
2636
|
when: FocusSearch
|
|
2630
2637
|
}, {
|
|
2631
|
-
key: Tab,
|
|
2632
2638
|
command: 'Search.focusNextInput',
|
|
2639
|
+
key: Tab,
|
|
2633
2640
|
when: FocusSearch
|
|
2634
2641
|
}, {
|
|
2635
|
-
key: Shift | Tab,
|
|
2636
2642
|
command: 'Search.focusPreviousInput',
|
|
2643
|
+
key: Shift | Tab,
|
|
2637
2644
|
when: FocusSearch
|
|
2638
2645
|
}, {
|
|
2639
|
-
key: UpArrow,
|
|
2640
2646
|
command: 'Search.previousHistoryResult',
|
|
2647
|
+
key: UpArrow,
|
|
2641
2648
|
when: FocusSearchInput
|
|
2642
2649
|
}, {
|
|
2643
|
-
key: DownArrow,
|
|
2644
2650
|
command: 'Search.nextHistoryResult',
|
|
2651
|
+
key: DownArrow,
|
|
2645
2652
|
when: FocusSearchInput
|
|
2646
2653
|
}, {
|
|
2647
|
-
key: Enter,
|
|
2648
2654
|
command: 'Search.submit',
|
|
2655
|
+
key: Enter,
|
|
2649
2656
|
when: FocusSearchInput
|
|
2650
2657
|
}, {
|
|
2651
|
-
key: Enter,
|
|
2652
2658
|
command: 'Search.submit',
|
|
2659
|
+
key: Enter,
|
|
2653
2660
|
when: FocusSearchReplaceInput
|
|
2654
2661
|
}];
|
|
2655
2662
|
};
|
|
2656
2663
|
|
|
2657
2664
|
const getSearchResultKeyBindings = () => {
|
|
2658
2665
|
return [{
|
|
2659
|
-
key: DownArrow,
|
|
2660
2666
|
command: 'Search.focusNext',
|
|
2667
|
+
key: DownArrow,
|
|
2661
2668
|
when: FocusSearchResults
|
|
2662
2669
|
}, {
|
|
2663
|
-
key: UpArrow,
|
|
2664
2670
|
command: 'Search.focusPrevious',
|
|
2671
|
+
key: UpArrow,
|
|
2665
2672
|
when: FocusSearchResults
|
|
2666
2673
|
}, {
|
|
2667
|
-
key: Delete,
|
|
2668
2674
|
command: 'Search.dismissItem',
|
|
2675
|
+
key: Delete,
|
|
2669
2676
|
when: FocusSearchResults
|
|
2670
2677
|
}, {
|
|
2671
|
-
key: Home,
|
|
2672
2678
|
command: 'Search.focusFirst',
|
|
2679
|
+
key: Home,
|
|
2673
2680
|
when: FocusSearchResults
|
|
2674
2681
|
}, {
|
|
2675
|
-
key: End,
|
|
2676
2682
|
command: 'Search.focusLast',
|
|
2683
|
+
key: End,
|
|
2677
2684
|
when: FocusSearchResults
|
|
2678
2685
|
}, {
|
|
2679
|
-
key: CtrlCmd | KeyC,
|
|
2680
2686
|
command: 'Search.copy',
|
|
2687
|
+
key: CtrlCmd | KeyC,
|
|
2681
2688
|
when: FocusSearchResults
|
|
2682
2689
|
}, {
|
|
2683
|
-
key: Delete,
|
|
2684
2690
|
command: 'Search.removeCurrent',
|
|
2691
|
+
key: Delete,
|
|
2685
2692
|
when: FocusSearchResults
|
|
2686
2693
|
}];
|
|
2687
2694
|
};
|
|
@@ -2691,10 +2698,10 @@ const getKeyBindings = () => {
|
|
|
2691
2698
|
};
|
|
2692
2699
|
|
|
2693
2700
|
const menuEntrySeparator = {
|
|
2694
|
-
|
|
2695
|
-
label: '',
|
|
2701
|
+
command: '',
|
|
2696
2702
|
flags: Separator,
|
|
2697
|
-
|
|
2703
|
+
id: 'separator',
|
|
2704
|
+
label: ''
|
|
2698
2705
|
};
|
|
2699
2706
|
|
|
2700
2707
|
const getMenuEntriesInput = options => {
|
|
@@ -2705,77 +2712,77 @@ const getMenuEntriesInput = options => {
|
|
|
2705
2712
|
return [];
|
|
2706
2713
|
}
|
|
2707
2714
|
return [{
|
|
2708
|
-
|
|
2709
|
-
label: cut(),
|
|
2710
|
-
flags: None$1,
|
|
2715
|
+
args: [inputName],
|
|
2711
2716
|
command: 'Search.handleInputCut',
|
|
2712
|
-
args: [inputName]
|
|
2713
|
-
}, {
|
|
2714
|
-
id: 'copy',
|
|
2715
|
-
label: copy(),
|
|
2716
2717
|
flags: None$1,
|
|
2717
|
-
|
|
2718
|
-
|
|
2718
|
+
id: 'cut',
|
|
2719
|
+
label: cut()
|
|
2719
2720
|
}, {
|
|
2720
|
-
|
|
2721
|
-
|
|
2721
|
+
args: [inputName],
|
|
2722
|
+
command: 'Search.handleInputCopy',
|
|
2722
2723
|
flags: None$1,
|
|
2724
|
+
id: 'copy',
|
|
2725
|
+
label: copy()
|
|
2726
|
+
}, {
|
|
2727
|
+
args: [inputName],
|
|
2723
2728
|
command: 'Search.handleInputPaste',
|
|
2724
|
-
args: [inputName]
|
|
2725
|
-
}, menuEntrySeparator, {
|
|
2726
|
-
id: 'selectAll',
|
|
2727
|
-
label: selectAll(),
|
|
2728
2729
|
flags: None$1,
|
|
2730
|
+
id: 'paste',
|
|
2731
|
+
label: paste()
|
|
2732
|
+
}, menuEntrySeparator, {
|
|
2733
|
+
args: [inputName],
|
|
2729
2734
|
command: 'Search.handleInputSelectAll',
|
|
2730
|
-
|
|
2735
|
+
flags: None$1,
|
|
2736
|
+
id: 'selectAll',
|
|
2737
|
+
label: selectAll()
|
|
2731
2738
|
}];
|
|
2732
2739
|
};
|
|
2733
2740
|
|
|
2734
2741
|
const getMenuEntriesFile = (state, props) => {
|
|
2735
2742
|
return [{
|
|
2736
|
-
|
|
2737
|
-
label: replaceAll$1(),
|
|
2743
|
+
command: 'Search.replaceAll',
|
|
2738
2744
|
flags: None$1,
|
|
2739
|
-
|
|
2745
|
+
id: 'replaceAll',
|
|
2746
|
+
label: replaceAll$1()
|
|
2740
2747
|
}, {
|
|
2741
|
-
|
|
2742
|
-
label: dismiss(),
|
|
2748
|
+
command: 'Search.removeCurrent',
|
|
2743
2749
|
flags: None$1,
|
|
2744
|
-
|
|
2750
|
+
id: 'dismiss',
|
|
2751
|
+
label: dismiss()
|
|
2745
2752
|
}, {
|
|
2746
|
-
|
|
2747
|
-
label: copy(),
|
|
2753
|
+
command: 'Search.copy',
|
|
2748
2754
|
flags: None$1,
|
|
2749
|
-
|
|
2755
|
+
id: 'copy',
|
|
2756
|
+
label: copy()
|
|
2750
2757
|
}, {
|
|
2751
|
-
|
|
2752
|
-
label: copyPath(),
|
|
2758
|
+
command: 'Search.copyPath',
|
|
2753
2759
|
flags: None$1,
|
|
2754
|
-
|
|
2760
|
+
id: 'copyPath',
|
|
2761
|
+
label: copyPath()
|
|
2755
2762
|
}, {
|
|
2756
|
-
|
|
2757
|
-
label: copyAll(),
|
|
2763
|
+
command: 'Search.copyAll',
|
|
2758
2764
|
flags: None$1,
|
|
2759
|
-
|
|
2765
|
+
id: 'copyAll',
|
|
2766
|
+
label: copyAll()
|
|
2760
2767
|
}];
|
|
2761
2768
|
};
|
|
2762
2769
|
|
|
2763
2770
|
const getMenuEntriesMatch = (state, props) => {
|
|
2764
2771
|
return [{
|
|
2765
|
-
|
|
2766
|
-
label: dismiss(),
|
|
2772
|
+
command: 'Search.removeCurrent',
|
|
2767
2773
|
flags: None$1,
|
|
2768
|
-
|
|
2774
|
+
id: 'dismiss',
|
|
2775
|
+
label: dismiss()
|
|
2769
2776
|
}, {
|
|
2770
|
-
|
|
2771
|
-
label: copy(),
|
|
2777
|
+
command: 'Search.copy',
|
|
2772
2778
|
flags: None$1,
|
|
2773
|
-
|
|
2779
|
+
id: 'copy',
|
|
2780
|
+
label: copy()
|
|
2774
2781
|
}, {
|
|
2775
|
-
|
|
2776
|
-
label: copyAll(),
|
|
2782
|
+
command: 'Search.copyAll',
|
|
2777
2783
|
flags: None$1,
|
|
2778
|
-
|
|
2784
|
+
id: 'copyAll',
|
|
2785
|
+
label: copyAll()
|
|
2779
2786
|
}];
|
|
2780
2787
|
};
|
|
2781
2788
|
|
|
@@ -2851,14 +2858,14 @@ const handleUpdateEmpty = (state, update) => {
|
|
|
2851
2858
|
};
|
|
2852
2859
|
return {
|
|
2853
2860
|
...partialNewState,
|
|
2854
|
-
minLineY: 0,
|
|
2855
|
-
maxLineY: 0,
|
|
2856
2861
|
deltaY: 0,
|
|
2857
2862
|
items: [],
|
|
2858
2863
|
listItems: [],
|
|
2864
|
+
loaded: true,
|
|
2859
2865
|
matchCount: 0,
|
|
2866
|
+
maxLineY: 0,
|
|
2860
2867
|
message: '',
|
|
2861
|
-
|
|
2868
|
+
minLineY: 0,
|
|
2862
2869
|
searchInputErrorMessage: ''
|
|
2863
2870
|
};
|
|
2864
2871
|
};
|
|
@@ -2870,13 +2877,13 @@ const handleUpdateError = async (state, update, error) => {
|
|
|
2870
2877
|
};
|
|
2871
2878
|
return {
|
|
2872
2879
|
...partialNewState,
|
|
2873
|
-
|
|
2880
|
+
fileCount: 0,
|
|
2874
2881
|
items: [],
|
|
2875
2882
|
listItems: [],
|
|
2876
2883
|
matchCount: 0,
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2884
|
+
maxLineY: 0,
|
|
2885
|
+
message: `${error}`,
|
|
2886
|
+
minLineY: 0
|
|
2880
2887
|
};
|
|
2881
2888
|
};
|
|
2882
2889
|
|
|
@@ -2942,38 +2949,38 @@ const handleUpdateFull = async (state, update) => {
|
|
|
2942
2949
|
...update
|
|
2943
2950
|
};
|
|
2944
2951
|
const {
|
|
2952
|
+
assetDir,
|
|
2953
|
+
excludeValue,
|
|
2954
|
+
fileIconCache,
|
|
2955
|
+
flags,
|
|
2956
|
+
headerHeight,
|
|
2945
2957
|
height,
|
|
2958
|
+
includeValue,
|
|
2946
2959
|
itemHeight,
|
|
2960
|
+
limit,
|
|
2947
2961
|
minimumSliderSize,
|
|
2948
|
-
headerHeight,
|
|
2949
|
-
flags,
|
|
2950
|
-
value,
|
|
2951
|
-
threads,
|
|
2952
|
-
includeValue,
|
|
2953
|
-
excludeValue,
|
|
2954
|
-
assetDir,
|
|
2955
2962
|
platform,
|
|
2956
|
-
|
|
2957
|
-
|
|
2963
|
+
threads,
|
|
2964
|
+
value
|
|
2958
2965
|
} = partialNewState;
|
|
2959
2966
|
const root = state.workspacePath;
|
|
2960
2967
|
const scheme = getProtocol(root);
|
|
2961
2968
|
const {
|
|
2962
|
-
|
|
2963
|
-
|
|
2969
|
+
limitHit,
|
|
2970
|
+
results
|
|
2964
2971
|
} = await textSearch$6(root, value, {
|
|
2965
|
-
|
|
2966
|
-
isCaseSensitive: Boolean(flags & MatchCase$2),
|
|
2967
|
-
useRegularExpression: Boolean(flags & UseRegularExpression$2),
|
|
2972
|
+
assetDir,
|
|
2968
2973
|
exclude: excludeValue,
|
|
2974
|
+
flags,
|
|
2969
2975
|
include: includeValue,
|
|
2970
|
-
|
|
2971
|
-
|
|
2976
|
+
isCaseSensitive: Boolean(flags & MatchCase$2),
|
|
2977
|
+
limit,
|
|
2978
|
+
matchWholeWord: Boolean(flags & MatchWholeWord$2),
|
|
2972
2979
|
query: value,
|
|
2980
|
+
root,
|
|
2973
2981
|
scheme,
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
limit
|
|
2982
|
+
threads,
|
|
2983
|
+
useRegularExpression: Boolean(flags & UseRegularExpression$2)
|
|
2977
2984
|
}, assetDir, platform);
|
|
2978
2985
|
if (!Array.isArray(results)) {
|
|
2979
2986
|
throw new TypeError('results must be of type array');
|
|
@@ -2998,6 +3005,7 @@ const handleUpdateFull = async (state, update) => {
|
|
|
2998
3005
|
const limitHitWarning = limitHit ? theResultSetOnlyContainsASubSetOfMatches() : '';
|
|
2999
3006
|
return {
|
|
3000
3007
|
...partialNewState,
|
|
3008
|
+
collapsedPaths: [],
|
|
3001
3009
|
deltaY: 0,
|
|
3002
3010
|
fileCount,
|
|
3003
3011
|
fileIconCache: newFileIconCache,
|
|
@@ -3015,15 +3023,14 @@ const handleUpdateFull = async (state, update) => {
|
|
|
3015
3023
|
scrollBarHeight,
|
|
3016
3024
|
searchInputErrorMessage: '',
|
|
3017
3025
|
threads,
|
|
3018
|
-
value
|
|
3019
|
-
collapsedPaths: []
|
|
3026
|
+
value
|
|
3020
3027
|
};
|
|
3021
3028
|
};
|
|
3022
3029
|
|
|
3023
3030
|
const getRipGrepArgs = ({
|
|
3024
|
-
threads,
|
|
3025
3031
|
isCaseSensitive,
|
|
3026
3032
|
searchString,
|
|
3033
|
+
threads,
|
|
3027
3034
|
useRegularExpression
|
|
3028
3035
|
}) => {
|
|
3029
3036
|
const ripGrepArgs = ['--hidden', '--no-require-git', '--smart-case', '--stats', '--json', '--threads', `${threads}`];
|
|
@@ -3050,8 +3057,8 @@ const {
|
|
|
3050
3057
|
|
|
3051
3058
|
const waitForNextFrame = async () => {
|
|
3052
3059
|
const {
|
|
3053
|
-
|
|
3054
|
-
|
|
3060
|
+
promise,
|
|
3061
|
+
resolve
|
|
3055
3062
|
} = Promise.withResolvers();
|
|
3056
3063
|
requestAnimationFrame(resolve);
|
|
3057
3064
|
await promise;
|
|
@@ -3065,9 +3072,9 @@ const textSearchIncremental = async (root, query, options, assetDir, platform, s
|
|
|
3065
3072
|
searchString: query
|
|
3066
3073
|
});
|
|
3067
3074
|
const actualOptions = {
|
|
3075
|
+
id: searchId,
|
|
3068
3076
|
ripGrepArgs,
|
|
3069
|
-
searchDir: root
|
|
3070
|
-
id: searchId
|
|
3077
|
+
searchDir: root
|
|
3071
3078
|
};
|
|
3072
3079
|
const resultPromise = invoke('TextSearch.searchIncremental', actualOptions);
|
|
3073
3080
|
for (let i = 0; i < 100; i++) {
|
|
@@ -3076,10 +3083,10 @@ const textSearchIncremental = async (root, query, options, assetDir, platform, s
|
|
|
3076
3083
|
newState
|
|
3077
3084
|
} = latest;
|
|
3078
3085
|
const {
|
|
3079
|
-
minLineY,
|
|
3080
|
-
height,
|
|
3081
3086
|
headerHeight,
|
|
3082
|
-
|
|
3087
|
+
height,
|
|
3088
|
+
itemHeight,
|
|
3089
|
+
minLineY
|
|
3083
3090
|
} = newState;
|
|
3084
3091
|
const listHeight = height - headerHeight;
|
|
3085
3092
|
const numberOfVisible = getNumberOfVisibleItems$1(listHeight, itemHeight);
|
|
@@ -3092,8 +3099,8 @@ const textSearchIncremental = async (root, query, options, assetDir, platform, s
|
|
|
3092
3099
|
...latest2.newState,
|
|
3093
3100
|
items: visible,
|
|
3094
3101
|
listItems: visible,
|
|
3095
|
-
|
|
3096
|
-
|
|
3102
|
+
maxLineY: visible.length,
|
|
3103
|
+
minLineY: 0
|
|
3097
3104
|
};
|
|
3098
3105
|
set(uid, latest2.oldState, updatedState2);
|
|
3099
3106
|
// @ts-ignore
|
|
@@ -3109,15 +3116,15 @@ const handleUpdateIncremental = async (state, update) => {
|
|
|
3109
3116
|
...update
|
|
3110
3117
|
};
|
|
3111
3118
|
const {
|
|
3119
|
+
assetDir,
|
|
3120
|
+
excludeValue,
|
|
3112
3121
|
flags,
|
|
3113
|
-
value,
|
|
3114
|
-
threads,
|
|
3115
3122
|
includeValue,
|
|
3116
|
-
excludeValue,
|
|
3117
3123
|
limit,
|
|
3124
|
+
platform,
|
|
3125
|
+
threads,
|
|
3118
3126
|
uid,
|
|
3119
|
-
|
|
3120
|
-
platform
|
|
3127
|
+
value
|
|
3121
3128
|
} = partialNewState;
|
|
3122
3129
|
const root = state.workspacePath;
|
|
3123
3130
|
const scheme = getProtocol(root);
|
|
@@ -3132,18 +3139,18 @@ const handleUpdateIncremental = async (state, update) => {
|
|
|
3132
3139
|
|
|
3133
3140
|
// TODO await promise?
|
|
3134
3141
|
void textSearchIncremental(root, value, {
|
|
3135
|
-
|
|
3136
|
-
isCaseSensitive: Boolean(flags & MatchCase$2),
|
|
3137
|
-
useRegularExpression: Boolean(flags & UseRegularExpression$2),
|
|
3142
|
+
assetDir: assetDir,
|
|
3138
3143
|
exclude: excludeValue,
|
|
3144
|
+
flags,
|
|
3139
3145
|
include: includeValue,
|
|
3140
|
-
|
|
3141
|
-
|
|
3146
|
+
isCaseSensitive: Boolean(flags & MatchCase$2),
|
|
3147
|
+
limit,
|
|
3148
|
+
matchWholeWord: Boolean(flags & MatchWholeWord$2),
|
|
3142
3149
|
query: value,
|
|
3150
|
+
root,
|
|
3143
3151
|
scheme,
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
limit
|
|
3152
|
+
threads,
|
|
3153
|
+
useRegularExpression: Boolean(flags & UseRegularExpression$2)
|
|
3147
3154
|
}, assetDir, platform, searchId, uid);
|
|
3148
3155
|
return state;
|
|
3149
3156
|
};
|
|
@@ -3229,12 +3236,12 @@ const handleActionClick = async (state, name) => {
|
|
|
3229
3236
|
return clearSearchResults$1(state);
|
|
3230
3237
|
case CollapseAll$1:
|
|
3231
3238
|
return collapseAll$1(state);
|
|
3232
|
-
case ViewAsTree:
|
|
3233
|
-
return viewAsTree(state);
|
|
3234
|
-
case Refresh$1:
|
|
3235
|
-
return refresh(state);
|
|
3236
3239
|
case OpenSearchEditor:
|
|
3237
3240
|
return openSearchEditor(state);
|
|
3241
|
+
case Refresh$1:
|
|
3242
|
+
return refresh(state);
|
|
3243
|
+
case ViewAsTree:
|
|
3244
|
+
return viewAsTree(state);
|
|
3238
3245
|
default:
|
|
3239
3246
|
return state;
|
|
3240
3247
|
}
|
|
@@ -3267,36 +3274,36 @@ const getReplacedMessage = (fileCount, replaceCount, replacement) => {
|
|
|
3267
3274
|
|
|
3268
3275
|
const getReplaceElements = (items, workspacePath, replacement) => {
|
|
3269
3276
|
let element = {
|
|
3270
|
-
|
|
3271
|
-
|
|
3277
|
+
changes: [],
|
|
3278
|
+
uri: ''
|
|
3272
3279
|
};
|
|
3273
3280
|
const bulkChanges = [];
|
|
3274
3281
|
let changes = [];
|
|
3275
3282
|
// TODO simplify code by first matching files with their elements, then creating bulk edits
|
|
3276
3283
|
for (const match of items) {
|
|
3277
3284
|
const {
|
|
3278
|
-
type,
|
|
3279
|
-
text,
|
|
3280
|
-
lineNumber,
|
|
3281
3285
|
end,
|
|
3282
|
-
|
|
3286
|
+
lineNumber,
|
|
3287
|
+
start,
|
|
3288
|
+
text,
|
|
3289
|
+
type
|
|
3283
3290
|
} = match;
|
|
3284
3291
|
if (type === File) {
|
|
3285
3292
|
changes = [];
|
|
3286
3293
|
const fileName = getFilePath(text);
|
|
3287
3294
|
const absolutePath = `${workspacePath}/${fileName}`;
|
|
3288
3295
|
element = {
|
|
3289
|
-
|
|
3290
|
-
|
|
3296
|
+
changes,
|
|
3297
|
+
uri: absolutePath
|
|
3291
3298
|
};
|
|
3292
3299
|
bulkChanges.push(element);
|
|
3293
3300
|
} else {
|
|
3294
3301
|
changes.push({
|
|
3295
|
-
|
|
3296
|
-
startRowIndex: lineNumber - 1,
|
|
3297
|
-
startColumnIndex: start,
|
|
3302
|
+
endColumnIndex: end,
|
|
3298
3303
|
endRowIndex: lineNumber,
|
|
3299
|
-
|
|
3304
|
+
startColumnIndex: start,
|
|
3305
|
+
startRowIndex: lineNumber - 1,
|
|
3306
|
+
text: replacement
|
|
3300
3307
|
});
|
|
3301
3308
|
}
|
|
3302
3309
|
}
|
|
@@ -3305,23 +3312,24 @@ const getReplaceElements = (items, workspacePath, replacement) => {
|
|
|
3305
3312
|
|
|
3306
3313
|
const replaceAll = async state => {
|
|
3307
3314
|
const {
|
|
3308
|
-
workspacePath,
|
|
3309
3315
|
items,
|
|
3316
|
+
matchCount,
|
|
3310
3317
|
replacement,
|
|
3311
|
-
|
|
3318
|
+
workspacePath
|
|
3312
3319
|
} = state;
|
|
3313
3320
|
const bulkEdits = getReplaceElements(items, workspacePath, replacement);
|
|
3314
3321
|
// TODO this function should return an error message if an error occurred during bulk edit
|
|
3315
3322
|
await applyBulkReplacement(bulkEdits);
|
|
3323
|
+
await handleWorkspaceRefresh();
|
|
3316
3324
|
const fileCount = bulkEdits.length;
|
|
3317
3325
|
const message = getReplacedMessage(fileCount, matchCount, replacement);
|
|
3318
3326
|
return {
|
|
3319
3327
|
...state,
|
|
3320
3328
|
items: [],
|
|
3321
3329
|
listItems: [],
|
|
3322
|
-
minLineY: 0,
|
|
3323
3330
|
maxLineY: 0,
|
|
3324
|
-
message
|
|
3331
|
+
message,
|
|
3332
|
+
minLineY: 0
|
|
3325
3333
|
};
|
|
3326
3334
|
};
|
|
3327
3335
|
|
|
@@ -3393,26 +3401,26 @@ const getClickHandler = name => {
|
|
|
3393
3401
|
switch (name) {
|
|
3394
3402
|
case MatchCase:
|
|
3395
3403
|
return toggleMatchCase;
|
|
3396
|
-
case ToggleReplace:
|
|
3397
|
-
return toggleReplace;
|
|
3398
|
-
case UseRegularExpression:
|
|
3399
|
-
return toggleUseRegularExpression;
|
|
3400
|
-
case ReplaceAll:
|
|
3401
|
-
return replaceAll;
|
|
3402
3404
|
case MatchWholeWord:
|
|
3403
3405
|
return toggleMatchWholeWord;
|
|
3404
3406
|
case PreserveCase:
|
|
3405
3407
|
return togglePreserveCase;
|
|
3406
|
-
case
|
|
3407
|
-
return
|
|
3408
|
+
case ReplaceAll:
|
|
3409
|
+
return replaceAll;
|
|
3410
|
+
case ReplaceValue:
|
|
3411
|
+
return focusReplaceValue$1;
|
|
3408
3412
|
case SearchOnlyOpenEditors:
|
|
3409
3413
|
return toggleOpenEditors;
|
|
3410
|
-
case UseExcludeSettings:
|
|
3411
|
-
return toggleUseIgnoreFiles;
|
|
3412
3414
|
case SearchValue:
|
|
3413
3415
|
return focusSearchValue$1;
|
|
3414
|
-
case
|
|
3415
|
-
return
|
|
3416
|
+
case ToggleReplace:
|
|
3417
|
+
return toggleReplace;
|
|
3418
|
+
case ToggleSearchDetails:
|
|
3419
|
+
return toggleDetailsExpanded;
|
|
3420
|
+
case UseExcludeSettings:
|
|
3421
|
+
return toggleUseIgnoreFiles;
|
|
3422
|
+
case UseRegularExpression:
|
|
3423
|
+
return toggleUseRegularExpression;
|
|
3416
3424
|
default:
|
|
3417
3425
|
return noop;
|
|
3418
3426
|
}
|
|
@@ -3437,16 +3445,16 @@ const handleHeaderFocusOut = state => {
|
|
|
3437
3445
|
}
|
|
3438
3446
|
return {
|
|
3439
3447
|
...state,
|
|
3440
|
-
|
|
3441
|
-
|
|
3448
|
+
focus: 0,
|
|
3449
|
+
focused: false
|
|
3442
3450
|
};
|
|
3443
3451
|
};
|
|
3444
3452
|
|
|
3445
3453
|
const handleIconThemeChange = async state => {
|
|
3446
3454
|
const {
|
|
3447
3455
|
items,
|
|
3448
|
-
|
|
3449
|
-
|
|
3456
|
+
maxLineY,
|
|
3457
|
+
minLineY
|
|
3450
3458
|
} = state;
|
|
3451
3459
|
const visibleItems = items.slice(minLineY, maxLineY);
|
|
3452
3460
|
const {
|
|
@@ -3455,8 +3463,8 @@ const handleIconThemeChange = async state => {
|
|
|
3455
3463
|
} = await getFileIcons(visibleItems, {});
|
|
3456
3464
|
return {
|
|
3457
3465
|
...state,
|
|
3458
|
-
|
|
3459
|
-
|
|
3466
|
+
fileIconCache: newFileIconCache,
|
|
3467
|
+
icons
|
|
3460
3468
|
};
|
|
3461
3469
|
};
|
|
3462
3470
|
|
|
@@ -3469,28 +3477,28 @@ const handleIncludeInput = (state, includeValue, inputSource = Script) => {
|
|
|
3469
3477
|
|
|
3470
3478
|
const handleInput = (state, value, inputSource = Script) => {
|
|
3471
3479
|
return handleUpdate(state, {
|
|
3472
|
-
|
|
3473
|
-
|
|
3480
|
+
inputSource,
|
|
3481
|
+
value
|
|
3474
3482
|
});
|
|
3475
3483
|
};
|
|
3476
3484
|
|
|
3477
3485
|
const handleReplaceInput = (state, value, inputSource = Script) => {
|
|
3478
3486
|
return handleUpdate(state, {
|
|
3479
|
-
|
|
3480
|
-
|
|
3487
|
+
inputSource,
|
|
3488
|
+
replacement: value
|
|
3481
3489
|
});
|
|
3482
3490
|
};
|
|
3483
3491
|
|
|
3484
3492
|
const getInputHandler = name => {
|
|
3485
3493
|
switch (name) {
|
|
3486
|
-
case SearchValue:
|
|
3487
|
-
return handleInput;
|
|
3488
|
-
case ReplaceValue:
|
|
3489
|
-
return handleReplaceInput;
|
|
3490
3494
|
case FilesToExclude:
|
|
3491
3495
|
return handleExcludeInput;
|
|
3492
3496
|
case FilesToInclude:
|
|
3493
3497
|
return handleIncludeInput;
|
|
3498
|
+
case ReplaceValue:
|
|
3499
|
+
return handleReplaceInput;
|
|
3500
|
+
case SearchValue:
|
|
3501
|
+
return handleInput;
|
|
3494
3502
|
default:
|
|
3495
3503
|
throw new Error(`unknown input handler: ${name}`);
|
|
3496
3504
|
}
|
|
@@ -3514,8 +3522,8 @@ const handleInputContextMenu = async (state, name, button, x, y) => {
|
|
|
3514
3522
|
uid
|
|
3515
3523
|
} = state;
|
|
3516
3524
|
await show2(uid, InputContextMenu, x, y, {
|
|
3517
|
-
|
|
3518
|
-
|
|
3525
|
+
inputName: name,
|
|
3526
|
+
menuId: InputContextMenu
|
|
3519
3527
|
});
|
|
3520
3528
|
return state;
|
|
3521
3529
|
};
|
|
@@ -3529,14 +3537,14 @@ const readText = async () => {
|
|
|
3529
3537
|
|
|
3530
3538
|
const getCurrentValue = (state, name) => {
|
|
3531
3539
|
switch (name) {
|
|
3532
|
-
case SearchValue:
|
|
3533
|
-
return state.value;
|
|
3534
3540
|
case FilesToExclude:
|
|
3535
3541
|
return state.excludeValue;
|
|
3536
3542
|
case FilesToInclude:
|
|
3537
3543
|
return state.includeValue;
|
|
3538
3544
|
case ReplaceValue:
|
|
3539
3545
|
return state.replacement;
|
|
3546
|
+
case SearchValue:
|
|
3547
|
+
return state.value;
|
|
3540
3548
|
default:
|
|
3541
3549
|
return '';
|
|
3542
3550
|
}
|
|
@@ -3555,8 +3563,8 @@ const getNewSelections = (selections, name, newValue) => {
|
|
|
3555
3563
|
return selections;
|
|
3556
3564
|
}
|
|
3557
3565
|
const {
|
|
3558
|
-
|
|
3559
|
-
|
|
3566
|
+
end,
|
|
3567
|
+
start
|
|
3560
3568
|
} = old;
|
|
3561
3569
|
const newSelection = newValue.length;
|
|
3562
3570
|
if (start === newSelection && end === newSelection) {
|
|
@@ -3565,8 +3573,8 @@ const getNewSelections = (selections, name, newValue) => {
|
|
|
3565
3573
|
return {
|
|
3566
3574
|
...selections,
|
|
3567
3575
|
[name]: {
|
|
3568
|
-
|
|
3569
|
-
|
|
3576
|
+
end: newSelection,
|
|
3577
|
+
start: newSelection
|
|
3570
3578
|
}
|
|
3571
3579
|
};
|
|
3572
3580
|
};
|
|
@@ -3576,33 +3584,33 @@ const updateValue = (state, name, newValue) => {
|
|
|
3576
3584
|
} = state;
|
|
3577
3585
|
const newSelections = getNewSelections(selections, name, newValue);
|
|
3578
3586
|
switch (name) {
|
|
3579
|
-
case
|
|
3587
|
+
case FilesToExclude:
|
|
3580
3588
|
return {
|
|
3581
3589
|
...state,
|
|
3582
|
-
|
|
3590
|
+
excludeValue: newValue,
|
|
3583
3591
|
inputSource: Script$1,
|
|
3584
3592
|
selections: newSelections
|
|
3585
3593
|
};
|
|
3586
|
-
case
|
|
3594
|
+
case FilesToInclude:
|
|
3587
3595
|
return {
|
|
3588
3596
|
...state,
|
|
3589
|
-
|
|
3597
|
+
includeValue: newValue,
|
|
3590
3598
|
inputSource: Script$1,
|
|
3591
3599
|
selections: newSelections
|
|
3592
3600
|
};
|
|
3593
|
-
case
|
|
3601
|
+
case ReplaceValue:
|
|
3594
3602
|
return {
|
|
3595
3603
|
...state,
|
|
3596
|
-
includeValue: newValue,
|
|
3597
3604
|
inputSource: Script$1,
|
|
3605
|
+
replacement: newValue,
|
|
3598
3606
|
selections: newSelections
|
|
3599
3607
|
};
|
|
3600
|
-
case
|
|
3608
|
+
case SearchValue:
|
|
3601
3609
|
return {
|
|
3602
3610
|
...state,
|
|
3603
|
-
excludeValue: newValue,
|
|
3604
3611
|
inputSource: Script$1,
|
|
3605
|
-
selections: newSelections
|
|
3612
|
+
selections: newSelections,
|
|
3613
|
+
value: newValue
|
|
3606
3614
|
};
|
|
3607
3615
|
default:
|
|
3608
3616
|
return state;
|
|
@@ -3621,8 +3629,8 @@ const handleInputPaste = async (state, name) => {
|
|
|
3621
3629
|
}
|
|
3622
3630
|
const selection = selections[name];
|
|
3623
3631
|
const {
|
|
3624
|
-
|
|
3625
|
-
|
|
3632
|
+
end,
|
|
3633
|
+
start
|
|
3626
3634
|
} = selection;
|
|
3627
3635
|
const currentText = getCurrentValue(state, name);
|
|
3628
3636
|
const insertedText = await readText();
|
|
@@ -3639,8 +3647,8 @@ const handleInputCopy = async (state, name) => {
|
|
|
3639
3647
|
}
|
|
3640
3648
|
const selection = selections[name];
|
|
3641
3649
|
const {
|
|
3642
|
-
|
|
3643
|
-
|
|
3650
|
+
end,
|
|
3651
|
+
start
|
|
3644
3652
|
} = selection;
|
|
3645
3653
|
const currentText = getCurrentValue(state, name);
|
|
3646
3654
|
const toCopy = currentText.slice(start, end);
|
|
@@ -3653,8 +3661,8 @@ const getNewTextCut = (currentText, selectionStart, selectionEnd) => {
|
|
|
3653
3661
|
const middle = currentText.slice(selectionStart, selectionEnd);
|
|
3654
3662
|
const post = currentText.slice(selectionEnd);
|
|
3655
3663
|
return {
|
|
3656
|
-
|
|
3657
|
-
|
|
3664
|
+
cutText: middle,
|
|
3665
|
+
newText: pre + post
|
|
3658
3666
|
};
|
|
3659
3667
|
};
|
|
3660
3668
|
|
|
@@ -3667,13 +3675,13 @@ const handleInputCut = async (state, name) => {
|
|
|
3667
3675
|
}
|
|
3668
3676
|
const selection = selections[name];
|
|
3669
3677
|
const {
|
|
3670
|
-
|
|
3671
|
-
|
|
3678
|
+
end,
|
|
3679
|
+
start
|
|
3672
3680
|
} = selection;
|
|
3673
3681
|
const currentText = getCurrentValue(state, name);
|
|
3674
3682
|
const {
|
|
3675
|
-
|
|
3676
|
-
|
|
3683
|
+
cutText,
|
|
3684
|
+
newText
|
|
3677
3685
|
} = getNewTextCut(currentText, start, end);
|
|
3678
3686
|
await writeText(cutText);
|
|
3679
3687
|
return updateValue(state, name, newText);
|
|
@@ -3681,32 +3689,32 @@ const handleInputCut = async (state, name) => {
|
|
|
3681
3689
|
|
|
3682
3690
|
const getSearchFocusKey = key => {
|
|
3683
3691
|
switch (key) {
|
|
3684
|
-
case
|
|
3685
|
-
return
|
|
3686
|
-
case
|
|
3687
|
-
return
|
|
3692
|
+
case FilesToExclude:
|
|
3693
|
+
return FocusSearchExcludeInput;
|
|
3694
|
+
case FilesToInclude:
|
|
3695
|
+
return FocusSearchIncludeInput;
|
|
3688
3696
|
case MatchCase:
|
|
3689
3697
|
return FocusSearchMatchCase;
|
|
3690
3698
|
case MatchWholeWord:
|
|
3691
3699
|
return FocusSearchWholeWord;
|
|
3692
|
-
case UseRegularExpression:
|
|
3693
|
-
return FocusSearchRegex;
|
|
3694
|
-
case ReplaceAll:
|
|
3695
|
-
return FocusSearchReplaceAll;
|
|
3696
3700
|
case PreserveCase:
|
|
3697
3701
|
return FocusSearchPreserveCase;
|
|
3698
|
-
case
|
|
3699
|
-
return
|
|
3700
|
-
case
|
|
3701
|
-
return
|
|
3702
|
-
case FilesToExclude:
|
|
3703
|
-
return FocusSearchExcludeInput;
|
|
3702
|
+
case ReplaceAll:
|
|
3703
|
+
return FocusSearchReplaceAll;
|
|
3704
|
+
case ReplaceValue:
|
|
3705
|
+
return FocusSearchReplaceInput;
|
|
3704
3706
|
case SearchOnlyOpenEditors:
|
|
3705
3707
|
return FocusSearchOpenEditors;
|
|
3706
|
-
case
|
|
3707
|
-
return
|
|
3708
|
+
case SearchValue:
|
|
3709
|
+
return FocusSearchInput;
|
|
3708
3710
|
case ToggleReplace:
|
|
3709
3711
|
return FocusToggleReplace;
|
|
3712
|
+
case ToggleSearchDetails:
|
|
3713
|
+
return FocusToggleDetails;
|
|
3714
|
+
case UseExcludeSettings:
|
|
3715
|
+
return FocusIgnoreFiles;
|
|
3716
|
+
case UseRegularExpression:
|
|
3717
|
+
return FocusSearchRegex;
|
|
3710
3718
|
default:
|
|
3711
3719
|
return Empty;
|
|
3712
3720
|
}
|
|
@@ -3716,9 +3724,9 @@ const handleInputFocus = (state, name) => {
|
|
|
3716
3724
|
const key = getSearchFocusKey(name);
|
|
3717
3725
|
return {
|
|
3718
3726
|
...state,
|
|
3719
|
-
listFocused: false,
|
|
3720
3727
|
focus: key,
|
|
3721
|
-
focused: true
|
|
3728
|
+
focused: true,
|
|
3729
|
+
listFocused: false
|
|
3722
3730
|
};
|
|
3723
3731
|
};
|
|
3724
3732
|
|
|
@@ -3736,8 +3744,8 @@ const handleInputSelectionChange = async (state, name, selectionStart, selection
|
|
|
3736
3744
|
return state;
|
|
3737
3745
|
}
|
|
3738
3746
|
const {
|
|
3739
|
-
|
|
3740
|
-
|
|
3747
|
+
end,
|
|
3748
|
+
start
|
|
3741
3749
|
} = old;
|
|
3742
3750
|
if (start === selectionStart && end === selectionEnd) {
|
|
3743
3751
|
return state;
|
|
@@ -3747,8 +3755,8 @@ const handleInputSelectionChange = async (state, name, selectionStart, selection
|
|
|
3747
3755
|
selections: {
|
|
3748
3756
|
...selections,
|
|
3749
3757
|
[name]: {
|
|
3750
|
-
|
|
3751
|
-
|
|
3758
|
+
end: selectionEnd,
|
|
3759
|
+
start: selectionStart
|
|
3752
3760
|
}
|
|
3753
3761
|
}
|
|
3754
3762
|
};
|
|
@@ -4176,11 +4184,11 @@ const toggleCollapsedPath = (collapsedPaths, path) => {
|
|
|
4176
4184
|
const selectIndexFile = async (state, searchResult, index) => {
|
|
4177
4185
|
const {
|
|
4178
4186
|
collapsedPaths,
|
|
4179
|
-
|
|
4180
|
-
itemHeight,
|
|
4187
|
+
fileIconCache,
|
|
4181
4188
|
headerHeight,
|
|
4182
4189
|
height,
|
|
4183
|
-
|
|
4190
|
+
itemHeight,
|
|
4191
|
+
items
|
|
4184
4192
|
} = state;
|
|
4185
4193
|
const path = searchResult.text;
|
|
4186
4194
|
const newCollapsedPaths = toggleCollapsedPath(collapsedPaths, path);
|
|
@@ -4252,10 +4260,10 @@ const selectIndexPreview = async (state, searchResult, index) => {
|
|
|
4252
4260
|
});
|
|
4253
4261
|
return {
|
|
4254
4262
|
...state,
|
|
4255
|
-
listFocusedIndex: index,
|
|
4256
|
-
listFocused: false,
|
|
4257
4263
|
focus: FocusSearchResults,
|
|
4258
|
-
focusSource: Script
|
|
4264
|
+
focusSource: Script,
|
|
4265
|
+
listFocused: false,
|
|
4266
|
+
listFocusedIndex: index
|
|
4259
4267
|
};
|
|
4260
4268
|
};
|
|
4261
4269
|
|
|
@@ -4288,12 +4296,12 @@ const selectIndex = async (state, index) => {
|
|
|
4288
4296
|
|
|
4289
4297
|
const handleClickAt = async (state, eventX, eventY, name) => {
|
|
4290
4298
|
const {
|
|
4291
|
-
x,
|
|
4292
|
-
y,
|
|
4293
|
-
itemHeight,
|
|
4294
4299
|
deltaY,
|
|
4295
4300
|
flags,
|
|
4296
|
-
|
|
4301
|
+
itemHeight,
|
|
4302
|
+
listItems,
|
|
4303
|
+
x,
|
|
4304
|
+
y
|
|
4297
4305
|
} = state;
|
|
4298
4306
|
const topHeight = getTopHeight(flags);
|
|
4299
4307
|
const index = getListIndex(eventX, eventY, x, y, deltaY, itemHeight, topHeight, listItems.length);
|
|
@@ -4379,39 +4387,40 @@ const getSavedCollapsedPaths = savedState => {
|
|
|
4379
4387
|
|
|
4380
4388
|
const restoreState = savedState => {
|
|
4381
4389
|
return {
|
|
4382
|
-
savedValue: getSavedValue(savedState),
|
|
4383
|
-
replacement: getSavedReplacement(savedState),
|
|
4384
|
-
savedCollapsedPaths: getSavedCollapsedPaths(savedState),
|
|
4385
|
-
threads: 1,
|
|
4386
|
-
flags: getSavedFlags(savedState),
|
|
4387
|
-
includeValue: getSavedIncludeValue(savedState),
|
|
4388
4390
|
excludeValue: getSavedExcludeValue(savedState),
|
|
4389
|
-
|
|
4391
|
+
flags: getSavedFlags(savedState),
|
|
4390
4392
|
focus: getSavedFocus(savedState),
|
|
4391
|
-
|
|
4393
|
+
history: getSavedHistory(savedState),
|
|
4394
|
+
includeValue: getSavedIncludeValue(savedState),
|
|
4395
|
+
listFocused: getSavedListFocus(savedState),
|
|
4396
|
+
replacement: getSavedReplacement(savedState),
|
|
4397
|
+
savedCollapsedPaths: getSavedCollapsedPaths(savedState),
|
|
4398
|
+
savedValue: getSavedValue(savedState),
|
|
4399
|
+
threads: 1
|
|
4392
4400
|
};
|
|
4393
4401
|
};
|
|
4394
4402
|
|
|
4395
4403
|
const loadContent = async (state, savedState) => {
|
|
4396
4404
|
const {
|
|
4397
|
-
|
|
4398
|
-
savedCollapsedPaths,
|
|
4399
|
-
threads,
|
|
4400
|
-
replacement,
|
|
4405
|
+
excludeValue,
|
|
4401
4406
|
flags,
|
|
4402
4407
|
includeValue,
|
|
4403
|
-
|
|
4408
|
+
replacement,
|
|
4409
|
+
savedCollapsedPaths,
|
|
4410
|
+
savedValue,
|
|
4411
|
+
threads
|
|
4404
4412
|
} = restoreState(savedState);
|
|
4405
4413
|
const update = {
|
|
4406
|
-
value: savedValue,
|
|
4407
|
-
threads,
|
|
4408
|
-
inputSource: Script,
|
|
4409
4414
|
collapsedPaths: savedCollapsedPaths,
|
|
4410
|
-
|
|
4415
|
+
excludeValue,
|
|
4411
4416
|
flags,
|
|
4417
|
+
focus: 0,
|
|
4418
|
+
// TODO
|
|
4412
4419
|
includeValue,
|
|
4413
|
-
|
|
4414
|
-
|
|
4420
|
+
inputSource: Script,
|
|
4421
|
+
replacement,
|
|
4422
|
+
threads,
|
|
4423
|
+
value: savedValue
|
|
4415
4424
|
};
|
|
4416
4425
|
if (savedValue) {
|
|
4417
4426
|
const result = await handleUpdate(state, update);
|
|
@@ -4423,23 +4432,23 @@ const loadContent = async (state, savedState) => {
|
|
|
4423
4432
|
return {
|
|
4424
4433
|
...state,
|
|
4425
4434
|
...update,
|
|
4426
|
-
threads,
|
|
4427
4435
|
flags,
|
|
4428
|
-
loaded: true
|
|
4436
|
+
loaded: true,
|
|
4437
|
+
threads
|
|
4429
4438
|
};
|
|
4430
4439
|
};
|
|
4431
4440
|
|
|
4432
4441
|
const getNextHistoryData = (history, historyIndex) => {
|
|
4433
4442
|
if (historyIndex === -1 || history.length === 0) {
|
|
4434
4443
|
return {
|
|
4435
|
-
|
|
4436
|
-
|
|
4444
|
+
newHistoryIndex: -1,
|
|
4445
|
+
newValue: ''
|
|
4437
4446
|
};
|
|
4438
4447
|
}
|
|
4439
4448
|
const item = history.at(historyIndex) || '';
|
|
4440
4449
|
return {
|
|
4441
|
-
|
|
4442
|
-
|
|
4450
|
+
newHistoryIndex: historyIndex + 1,
|
|
4451
|
+
newValue: item
|
|
4443
4452
|
};
|
|
4444
4453
|
};
|
|
4445
4454
|
|
|
@@ -4450,16 +4459,16 @@ const nextHistoryResult = async state => {
|
|
|
4450
4459
|
value
|
|
4451
4460
|
} = state;
|
|
4452
4461
|
const {
|
|
4453
|
-
|
|
4454
|
-
|
|
4462
|
+
newHistoryIndex,
|
|
4463
|
+
newValue
|
|
4455
4464
|
} = getNextHistoryData(history, historyIndex);
|
|
4456
4465
|
if (newValue === value) {
|
|
4457
4466
|
return state;
|
|
4458
4467
|
}
|
|
4459
4468
|
return handleUpdate(state, {
|
|
4460
|
-
|
|
4469
|
+
historyIndex: newHistoryIndex,
|
|
4461
4470
|
inputSource: Script,
|
|
4462
|
-
|
|
4471
|
+
value: newValue
|
|
4463
4472
|
});
|
|
4464
4473
|
};
|
|
4465
4474
|
|
|
@@ -4483,34 +4492,34 @@ const removeCurrent = async state => {
|
|
|
4483
4492
|
|
|
4484
4493
|
const getFocusSelector = focusKey => {
|
|
4485
4494
|
switch (focusKey) {
|
|
4495
|
+
case FocusIgnoreFiles:
|
|
4496
|
+
return UseExcludeSettings;
|
|
4497
|
+
case FocusSearchExcludeInput:
|
|
4498
|
+
return FilesToExclude;
|
|
4499
|
+
case FocusSearchIncludeInput:
|
|
4500
|
+
return FilesToInclude;
|
|
4486
4501
|
case FocusSearchInput:
|
|
4487
4502
|
return SearchValue;
|
|
4488
|
-
case FocusSearchReplaceInput:
|
|
4489
|
-
return ReplaceValue;
|
|
4490
|
-
case FocusToggleDetails:
|
|
4491
|
-
return ToggleSearchDetails;
|
|
4492
4503
|
case FocusSearchMatchCase:
|
|
4493
4504
|
return MatchCase;
|
|
4505
|
+
case FocusSearchOpenEditors:
|
|
4506
|
+
return SearchOnlyOpenEditors;
|
|
4494
4507
|
case FocusSearchPreserveCase:
|
|
4495
4508
|
return PreserveCase;
|
|
4496
4509
|
case FocusSearchRegex:
|
|
4497
4510
|
return UseRegularExpression;
|
|
4498
|
-
case FocusSearchIncludeInput:
|
|
4499
|
-
return FilesToInclude;
|
|
4500
|
-
case FocusSearchExcludeInput:
|
|
4501
|
-
return FilesToExclude;
|
|
4502
|
-
case FocusSearchWholeWord:
|
|
4503
|
-
return MatchWholeWord;
|
|
4504
4511
|
case FocusSearchReplaceAll:
|
|
4505
4512
|
return ReplaceAll;
|
|
4506
|
-
case
|
|
4507
|
-
return
|
|
4508
|
-
case FocusIgnoreFiles:
|
|
4509
|
-
return UseExcludeSettings;
|
|
4510
|
-
case FocusToggleReplace:
|
|
4511
|
-
return ToggleReplace;
|
|
4513
|
+
case FocusSearchReplaceInput:
|
|
4514
|
+
return ReplaceValue;
|
|
4512
4515
|
case FocusSearchResults:
|
|
4513
4516
|
return '.Tree';
|
|
4517
|
+
case FocusSearchWholeWord:
|
|
4518
|
+
return MatchWholeWord;
|
|
4519
|
+
case FocusToggleDetails:
|
|
4520
|
+
return ToggleSearchDetails;
|
|
4521
|
+
case FocusToggleReplace:
|
|
4522
|
+
return ToggleReplace;
|
|
4514
4523
|
default:
|
|
4515
4524
|
return '';
|
|
4516
4525
|
}
|
|
@@ -4583,9 +4592,9 @@ const getDisplayResultMatch = (setSize, searchTermLength, replacement, text, pos
|
|
|
4583
4592
|
const getDisplayResult = (results, fileIcons, i, setSize, searchTermLength, replacement, focusedIndex, collapsedPaths, minLineY, originalResults) => {
|
|
4584
4593
|
const result = results[i];
|
|
4585
4594
|
const {
|
|
4586
|
-
|
|
4595
|
+
start,
|
|
4587
4596
|
text,
|
|
4588
|
-
|
|
4597
|
+
type
|
|
4589
4598
|
} = result;
|
|
4590
4599
|
const posInSet = i + 1;
|
|
4591
4600
|
const focused = i === focusedIndex;
|
|
@@ -4617,46 +4626,46 @@ const createViewModel = state => {
|
|
|
4617
4626
|
// TODO add viewmodel to state, not needing to have separate states and making it easier to compare
|
|
4618
4627
|
// visible items in diff
|
|
4619
4628
|
const {
|
|
4620
|
-
listItems,
|
|
4621
|
-
itemHeight,
|
|
4622
|
-
fileCount,
|
|
4623
|
-
value,
|
|
4624
|
-
minLineY,
|
|
4625
|
-
maxLineY,
|
|
4626
|
-
replacement,
|
|
4627
|
-
icons,
|
|
4628
|
-
listFocusedIndex,
|
|
4629
4629
|
collapsedPaths,
|
|
4630
|
-
items,
|
|
4631
|
-
listFocused,
|
|
4632
4630
|
deltaY,
|
|
4631
|
+
fileCount,
|
|
4633
4632
|
finalDeltaY,
|
|
4634
|
-
height,
|
|
4635
|
-
headerHeight,
|
|
4636
4633
|
flags,
|
|
4634
|
+
focus,
|
|
4635
|
+
headerHeight,
|
|
4636
|
+
height,
|
|
4637
|
+
icons,
|
|
4638
|
+
itemHeight,
|
|
4639
|
+
items,
|
|
4640
|
+
listFocused,
|
|
4641
|
+
listFocusedIndex,
|
|
4642
|
+
listItems,
|
|
4643
|
+
matchCount,
|
|
4644
|
+
maxLineY,
|
|
4637
4645
|
message,
|
|
4638
|
-
|
|
4646
|
+
minLineY,
|
|
4647
|
+
replacement,
|
|
4639
4648
|
scrollBarHeight,
|
|
4640
|
-
|
|
4641
|
-
|
|
4649
|
+
searchInputErrorMessage,
|
|
4650
|
+
value
|
|
4642
4651
|
} = state;
|
|
4643
4652
|
const displayResults = getDisplayResults(listItems, itemHeight, fileCount, value, minLineY, maxLineY, replacement, icons, listFocusedIndex, collapsedPaths, items);
|
|
4644
4653
|
const focusOutline = listFocused && listFocusedIndex === -1;
|
|
4645
4654
|
const scrollBarValue = deltaY / finalDeltaY * 100;
|
|
4646
4655
|
const scrollBarY = getScrollBarY$1(deltaY, finalDeltaY, height - headerHeight, scrollBarHeight);
|
|
4647
4656
|
return {
|
|
4657
|
+
deltaY,
|
|
4648
4658
|
displayResults,
|
|
4649
4659
|
flags,
|
|
4650
|
-
|
|
4660
|
+
focus,
|
|
4651
4661
|
focusOutline,
|
|
4652
|
-
searchInputErrorMessage,
|
|
4653
|
-
scrollBarHeight,
|
|
4654
|
-
scrollBarY,
|
|
4655
|
-
scrollBarValue,
|
|
4656
|
-
deltaY,
|
|
4657
4662
|
itemHeight,
|
|
4658
4663
|
matchCount,
|
|
4659
|
-
|
|
4664
|
+
message,
|
|
4665
|
+
scrollBarHeight,
|
|
4666
|
+
scrollBarValue,
|
|
4667
|
+
scrollBarY,
|
|
4668
|
+
searchInputErrorMessage
|
|
4660
4669
|
};
|
|
4661
4670
|
};
|
|
4662
4671
|
|
|
@@ -4684,19 +4693,19 @@ const HandleActionClick = 22;
|
|
|
4684
4693
|
|
|
4685
4694
|
const getSearchDetailsToggleVirtualDom = () => {
|
|
4686
4695
|
return [{
|
|
4687
|
-
|
|
4696
|
+
ariaLabel: toggleSearchDetails(),
|
|
4697
|
+
childCount: 1,
|
|
4688
4698
|
className: ToggleDetails,
|
|
4699
|
+
name: ToggleSearchDetails,
|
|
4700
|
+
onClick: HandleButtonClick,
|
|
4689
4701
|
role: Button$3,
|
|
4690
4702
|
tabIndex: 0,
|
|
4691
|
-
ariaLabel: toggleSearchDetails(),
|
|
4692
4703
|
title: toggleSearchDetails(),
|
|
4693
|
-
|
|
4694
|
-
onClick: HandleButtonClick,
|
|
4695
|
-
childCount: 1
|
|
4704
|
+
type: Button$2
|
|
4696
4705
|
}, {
|
|
4697
|
-
|
|
4706
|
+
childCount: 0,
|
|
4698
4707
|
className: mergeClassNames(MaskIcon, MaskIconEllipsis),
|
|
4699
|
-
|
|
4708
|
+
type: Div
|
|
4700
4709
|
}];
|
|
4701
4710
|
};
|
|
4702
4711
|
|
|
@@ -4708,18 +4717,18 @@ const getClassName$1 = indented => {
|
|
|
4708
4717
|
};
|
|
4709
4718
|
const getSearchMessageVirtualDom = (message, indented) => {
|
|
4710
4719
|
return [{
|
|
4711
|
-
|
|
4720
|
+
childCount: 1,
|
|
4712
4721
|
className: getClassName$1(indented),
|
|
4713
4722
|
role: Status,
|
|
4714
|
-
|
|
4723
|
+
type: Div
|
|
4715
4724
|
}, text(message)];
|
|
4716
4725
|
};
|
|
4717
4726
|
|
|
4718
4727
|
const getSearchHeaderDetailsCollapsedVirtualDom = message => {
|
|
4719
4728
|
return [{
|
|
4720
|
-
|
|
4729
|
+
childCount: 2,
|
|
4721
4730
|
className: SearchHeaderDetails,
|
|
4722
|
-
|
|
4731
|
+
type: Div
|
|
4723
4732
|
}, ...getSearchMessageVirtualDom(message, true), ...getSearchDetailsToggleVirtualDom()];
|
|
4724
4733
|
};
|
|
4725
4734
|
|
|
@@ -4730,11 +4739,11 @@ const ButtonDisabled = 3;
|
|
|
4730
4739
|
|
|
4731
4740
|
const getInputActionsExclude = flags => {
|
|
4732
4741
|
const inside = [{
|
|
4733
|
-
icon: MaskIconExclude,
|
|
4734
|
-
title: useExcludeSettings(),
|
|
4735
4742
|
command: 'toggleUseExcludeSettings',
|
|
4736
4743
|
flag: flags & UseIgnoreFiles ? CheckBoxEnabled : CheckBoxDisabled,
|
|
4737
|
-
|
|
4744
|
+
icon: MaskIconExclude,
|
|
4745
|
+
name: UseExcludeSettings,
|
|
4746
|
+
title: useExcludeSettings()
|
|
4738
4747
|
}];
|
|
4739
4748
|
const outside = [];
|
|
4740
4749
|
return {
|
|
@@ -4745,11 +4754,11 @@ const getInputActionsExclude = flags => {
|
|
|
4745
4754
|
|
|
4746
4755
|
const getInputActionsInclude = flags => {
|
|
4747
4756
|
const inside = [{
|
|
4748
|
-
icon: MaskIconBook,
|
|
4749
|
-
title: searchOnlyOpenEditors(),
|
|
4750
4757
|
command: 'searchOnlyOpenEditors',
|
|
4751
4758
|
flag: flags & OpenEditors ? CheckBoxEnabled : CheckBoxDisabled,
|
|
4752
|
-
|
|
4759
|
+
icon: MaskIconBook,
|
|
4760
|
+
name: SearchOnlyOpenEditors,
|
|
4761
|
+
title: searchOnlyOpenEditors()
|
|
4753
4762
|
}];
|
|
4754
4763
|
const outside = [];
|
|
4755
4764
|
return {
|
|
@@ -4765,10 +4774,10 @@ const getSearchFieldButtonClassName = flag => {
|
|
|
4765
4774
|
// TODO maybe move logic to viewmodel, which returns ariaChecked 1 | 2 | 3
|
|
4766
4775
|
const getAriaChecked = flag => {
|
|
4767
4776
|
switch (flag) {
|
|
4768
|
-
case CheckBoxEnabled:
|
|
4769
|
-
return true;
|
|
4770
4777
|
case CheckBoxDisabled:
|
|
4771
4778
|
return false;
|
|
4779
|
+
case CheckBoxEnabled:
|
|
4780
|
+
return true;
|
|
4772
4781
|
default:
|
|
4773
4782
|
return undefined;
|
|
4774
4783
|
}
|
|
@@ -4777,8 +4786,8 @@ const getAriaChecked = flag => {
|
|
|
4777
4786
|
// TODO have have separate renderers for checkbox and button elements
|
|
4778
4787
|
const getRole = flag => {
|
|
4779
4788
|
switch (flag) {
|
|
4780
|
-
case CheckBoxEnabled:
|
|
4781
4789
|
case CheckBoxDisabled:
|
|
4790
|
+
case CheckBoxEnabled:
|
|
4782
4791
|
return CheckBox;
|
|
4783
4792
|
default:
|
|
4784
4793
|
return undefined;
|
|
@@ -4794,79 +4803,79 @@ const getDisabled = flag => {
|
|
|
4794
4803
|
};
|
|
4795
4804
|
const getSearchFieldButtonVirtualDom = button => {
|
|
4796
4805
|
const {
|
|
4806
|
+
flag,
|
|
4797
4807
|
icon,
|
|
4798
|
-
title,
|
|
4799
4808
|
name,
|
|
4800
|
-
|
|
4809
|
+
title
|
|
4801
4810
|
} = button;
|
|
4802
4811
|
const ariaChecked = getAriaChecked(flag);
|
|
4803
4812
|
const role = getRole(flag);
|
|
4804
4813
|
const disabled = getDisabled(flag);
|
|
4805
4814
|
return [{
|
|
4806
|
-
|
|
4815
|
+
ariaChecked,
|
|
4816
|
+
childCount: 1,
|
|
4807
4817
|
className: getSearchFieldButtonClassName(flag),
|
|
4818
|
+
disabled,
|
|
4808
4819
|
name,
|
|
4809
|
-
|
|
4820
|
+
onClick: HandleButtonClick,
|
|
4810
4821
|
role,
|
|
4811
|
-
ariaChecked,
|
|
4812
|
-
disabled,
|
|
4813
4822
|
tabIndex: 0,
|
|
4814
|
-
|
|
4815
|
-
|
|
4823
|
+
title,
|
|
4824
|
+
type: Button$2
|
|
4816
4825
|
}, {
|
|
4817
|
-
|
|
4826
|
+
childCount: 0,
|
|
4818
4827
|
className: mergeClassNames(MaskIcon, icon),
|
|
4819
|
-
|
|
4828
|
+
type: Span
|
|
4820
4829
|
}];
|
|
4821
4830
|
};
|
|
4822
4831
|
|
|
4823
4832
|
const getOutSideButtonsDom = outsideButtons => {
|
|
4824
4833
|
if (outsideButtons.length === 0) {
|
|
4825
4834
|
return {
|
|
4826
|
-
|
|
4827
|
-
|
|
4835
|
+
postNodes: [],
|
|
4836
|
+
preNodes: []
|
|
4828
4837
|
};
|
|
4829
4838
|
}
|
|
4830
4839
|
return {
|
|
4840
|
+
postNodes: outsideButtons.flatMap(getSearchFieldButtonVirtualDom),
|
|
4831
4841
|
preNodes: [{
|
|
4832
|
-
|
|
4842
|
+
childCount: 1 + outsideButtons.length,
|
|
4833
4843
|
className: SearchFieldContainer,
|
|
4834
4844
|
role: None$2,
|
|
4835
|
-
|
|
4836
|
-
}]
|
|
4837
|
-
postNodes: outsideButtons.flatMap(getSearchFieldButtonVirtualDom)
|
|
4845
|
+
type: Div
|
|
4846
|
+
}]
|
|
4838
4847
|
};
|
|
4839
4848
|
};
|
|
4840
4849
|
|
|
4841
4850
|
const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, outsideButtons, hasError = false) => {
|
|
4842
4851
|
const {
|
|
4843
|
-
|
|
4844
|
-
|
|
4852
|
+
postNodes,
|
|
4853
|
+
preNodes
|
|
4845
4854
|
} = getOutSideButtonsDom(outsideButtons);
|
|
4846
4855
|
const searchFieldClassName = hasError ? mergeClassNames(SearchField, SearchFieldError) : SearchField;
|
|
4847
4856
|
const dom = [...preNodes, {
|
|
4848
|
-
|
|
4857
|
+
childCount: 2,
|
|
4849
4858
|
className: searchFieldClassName,
|
|
4850
4859
|
role: None$2,
|
|
4851
|
-
|
|
4860
|
+
type: Div
|
|
4852
4861
|
}, {
|
|
4853
|
-
type: TextArea,
|
|
4854
|
-
className: MultilineInputBox,
|
|
4855
|
-
spellcheck: false,
|
|
4856
4862
|
autocapitalize: 'off',
|
|
4857
4863
|
autocorrect: 'off',
|
|
4858
|
-
|
|
4864
|
+
childCount: 0,
|
|
4865
|
+
className: MultilineInputBox,
|
|
4859
4866
|
name,
|
|
4860
|
-
onInput,
|
|
4861
|
-
onFocus: HandleInputFocus,
|
|
4862
4867
|
onBlur: HandleInputBlur,
|
|
4863
4868
|
onContextMenu: HandleInputContextMenu,
|
|
4869
|
+
onFocus: HandleInputFocus,
|
|
4870
|
+
onInput,
|
|
4864
4871
|
onSelectionChange: HandleInputSelectionChange,
|
|
4865
|
-
|
|
4872
|
+
placeholder,
|
|
4873
|
+
spellcheck: false,
|
|
4874
|
+
type: TextArea
|
|
4866
4875
|
}, {
|
|
4867
|
-
|
|
4876
|
+
childCount: insideButtons.length,
|
|
4868
4877
|
className: SearchFieldButtons,
|
|
4869
|
-
|
|
4878
|
+
type: Div
|
|
4870
4879
|
}, ...insideButtons.flatMap(getSearchFieldButtonVirtualDom), ...postNodes];
|
|
4871
4880
|
return dom;
|
|
4872
4881
|
};
|
|
@@ -4877,21 +4886,21 @@ const getSearchHeaderDetailsExpandedVirtualDom = (flags, message) => {
|
|
|
4877
4886
|
const includePlaceholder = include();
|
|
4878
4887
|
const excludePlaceholder = exclude();
|
|
4879
4888
|
return [{
|
|
4880
|
-
|
|
4889
|
+
childCount: 5,
|
|
4881
4890
|
className: SearchHeaderDetailsExpanded,
|
|
4882
|
-
|
|
4891
|
+
type: Div
|
|
4883
4892
|
}, {
|
|
4884
|
-
|
|
4893
|
+
childCount: 2,
|
|
4885
4894
|
className: SearchHeaderDetailsExpandedTop,
|
|
4886
|
-
|
|
4895
|
+
type: Div
|
|
4887
4896
|
}, ...getSearchDetailsToggleVirtualDom(), {
|
|
4888
|
-
|
|
4897
|
+
childCount: 1,
|
|
4889
4898
|
className: SearchHeaderDetailsHeading,
|
|
4890
|
-
|
|
4899
|
+
type: H4
|
|
4891
4900
|
}, text(filesToInclude()), ...getSearchFieldVirtualDom(FilesToInclude, includePlaceholder, HandleInput2, includeButtons.inside, includeButtons.outside), {
|
|
4892
|
-
|
|
4901
|
+
childCount: 1,
|
|
4893
4902
|
className: SearchHeaderDetailsHeading,
|
|
4894
|
-
|
|
4903
|
+
type: H4
|
|
4895
4904
|
}, text(filesToExclude()), ...getSearchFieldVirtualDom(FilesToExclude, excludePlaceholder, HandleInput2, excludeButtons.inside, excludeButtons.outside), ...getSearchMessageVirtualDom(message, false)];
|
|
4896
4905
|
};
|
|
4897
4906
|
|
|
@@ -4908,14 +4917,14 @@ const getSearchHeaderLimitHitVirtualDom = limitHitWarning => {
|
|
|
4908
4917
|
if (!limitHitWarning) {
|
|
4909
4918
|
// TODO remove unused dom node
|
|
4910
4919
|
return [{
|
|
4911
|
-
|
|
4912
|
-
|
|
4920
|
+
childCount: 0,
|
|
4921
|
+
type: Div
|
|
4913
4922
|
}];
|
|
4914
4923
|
}
|
|
4915
4924
|
const dom = [{
|
|
4916
|
-
|
|
4925
|
+
childCount: 1,
|
|
4917
4926
|
className: SearchWarningMessage,
|
|
4918
|
-
|
|
4927
|
+
type: Div
|
|
4919
4928
|
},
|
|
4920
4929
|
// TODO warning triangle here
|
|
4921
4930
|
text(limitHitWarning)];
|
|
@@ -4924,20 +4933,20 @@ const getSearchHeaderLimitHitVirtualDom = limitHitWarning => {
|
|
|
4924
4933
|
|
|
4925
4934
|
const getInputActionsInput = flags => {
|
|
4926
4935
|
const inside = [{
|
|
4927
|
-
icon: MaskIconCaseSensitive,
|
|
4928
4936
|
flag: flags & MatchCase$2 ? CheckBoxEnabled : CheckBoxDisabled,
|
|
4929
|
-
|
|
4930
|
-
name: MatchCase
|
|
4937
|
+
icon: MaskIconCaseSensitive,
|
|
4938
|
+
name: MatchCase,
|
|
4939
|
+
title: matchCase()
|
|
4931
4940
|
}, {
|
|
4932
|
-
icon: MaskIconWholeWord,
|
|
4933
4941
|
flag: flags & MatchWholeWord$2 ? CheckBoxEnabled : CheckBoxDisabled,
|
|
4934
|
-
|
|
4935
|
-
name: MatchWholeWord
|
|
4942
|
+
icon: MaskIconWholeWord,
|
|
4943
|
+
name: MatchWholeWord,
|
|
4944
|
+
title: matchWholeWord()
|
|
4936
4945
|
}, {
|
|
4937
|
-
icon: MaskIconRegex,
|
|
4938
4946
|
flag: flags & UseRegularExpression$2 ? CheckBoxEnabled : CheckBoxDisabled,
|
|
4939
|
-
|
|
4940
|
-
name: UseRegularExpression
|
|
4947
|
+
icon: MaskIconRegex,
|
|
4948
|
+
name: UseRegularExpression,
|
|
4949
|
+
title: useRegularExpression()
|
|
4941
4950
|
}];
|
|
4942
4951
|
const outside = [];
|
|
4943
4952
|
return {
|
|
@@ -4948,16 +4957,16 @@ const getInputActionsInput = flags => {
|
|
|
4948
4957
|
|
|
4949
4958
|
const getInputActionsReplace = (flags, matchCount) => {
|
|
4950
4959
|
const inside = [{
|
|
4951
|
-
icon: MaskIconPreserveCase,
|
|
4952
4960
|
flag: flags & PreserveCase$2 ? CheckBoxEnabled : CheckBoxDisabled,
|
|
4953
|
-
|
|
4954
|
-
name: PreserveCase
|
|
4961
|
+
icon: MaskIconPreserveCase,
|
|
4962
|
+
name: PreserveCase,
|
|
4963
|
+
title: preserveCase()
|
|
4955
4964
|
}];
|
|
4956
4965
|
const outside = [{
|
|
4957
|
-
icon: MaskIconReplaceAll,
|
|
4958
4966
|
flag: matchCount === 0 ? ButtonDisabled : ButtonEnabled,
|
|
4959
|
-
|
|
4960
|
-
name: ReplaceAll
|
|
4967
|
+
icon: MaskIconReplaceAll,
|
|
4968
|
+
name: ReplaceAll,
|
|
4969
|
+
title: replaceAll$1()
|
|
4961
4970
|
}];
|
|
4962
4971
|
return {
|
|
4963
4972
|
inside,
|
|
@@ -4981,19 +4990,19 @@ const getSearchPlaceholder = focus => {
|
|
|
4981
4990
|
|
|
4982
4991
|
const getSearchToggleVirtualDom = replaceExpanded => {
|
|
4983
4992
|
return [{
|
|
4984
|
-
|
|
4985
|
-
className: mergeClassNames(IconButton, SearchToggleButton, replaceExpanded ? SearchToggleButtonExpanded : ''),
|
|
4986
|
-
title: toggleReplace$1(),
|
|
4993
|
+
ariaExpanded: Boolean(replaceExpanded),
|
|
4987
4994
|
ariaLabel: toggleReplace$1(),
|
|
4988
4995
|
// TODO compute label only once
|
|
4989
|
-
ariaExpanded: Boolean(replaceExpanded),
|
|
4990
4996
|
childCount: 1,
|
|
4997
|
+
className: mergeClassNames(IconButton, SearchToggleButton, replaceExpanded ? SearchToggleButtonExpanded : ''),
|
|
4991
4998
|
name: ToggleReplace,
|
|
4992
|
-
onClick: HandleButtonClick
|
|
4999
|
+
onClick: HandleButtonClick,
|
|
5000
|
+
title: toggleReplace$1(),
|
|
5001
|
+
type: Button$2
|
|
4993
5002
|
}, {
|
|
4994
|
-
|
|
5003
|
+
childCount: 0,
|
|
4995
5004
|
className: mergeClassNames(MaskIcon, replaceExpanded ? MaskIconChevronDown : MaskIconChevronRight),
|
|
4996
|
-
|
|
5005
|
+
type: Div
|
|
4997
5006
|
}];
|
|
4998
5007
|
};
|
|
4999
5008
|
|
|
@@ -5004,15 +5013,15 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
|
|
|
5004
5013
|
const replacePlaceholder = getReplacePlaceholder(focus);
|
|
5005
5014
|
const replaceExpanded = flags & ReplaceExpanded;
|
|
5006
5015
|
const dom = [{
|
|
5007
|
-
|
|
5016
|
+
childCount: 2,
|
|
5008
5017
|
className: SearchHeaderTop,
|
|
5009
5018
|
role: None$2,
|
|
5010
|
-
|
|
5019
|
+
type: Div
|
|
5011
5020
|
}, ...getSearchToggleVirtualDom(replaceExpanded), {
|
|
5012
|
-
|
|
5021
|
+
childCount: replaceExpanded ? 2 : 1,
|
|
5013
5022
|
className: SearchHeaderTopRight,
|
|
5014
5023
|
role: None$2,
|
|
5015
|
-
|
|
5024
|
+
type: Div
|
|
5016
5025
|
}, ...getSearchFieldVirtualDom(SearchValue, searchPlaceholder, HandleInput2, inputActions.inside, inputActions.outside, Boolean(searchInputErrorMessage))];
|
|
5017
5026
|
if (flags & ReplaceExpanded) {
|
|
5018
5027
|
dom.push(...getSearchFieldVirtualDom(ReplaceValue, replacePlaceholder, HandleInput2, replaceActions.inside, replaceActions.outside));
|
|
@@ -5021,11 +5030,11 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
|
|
|
5021
5030
|
};
|
|
5022
5031
|
|
|
5023
5032
|
const parentNode = {
|
|
5024
|
-
|
|
5033
|
+
childCount: 3,
|
|
5025
5034
|
className: SearchHeader,
|
|
5035
|
+
onContextMenu: HandleHeaderContextMenu,
|
|
5026
5036
|
role: None$2,
|
|
5027
|
-
|
|
5028
|
-
onContextMenu: HandleHeaderContextMenu
|
|
5037
|
+
type: Div
|
|
5029
5038
|
};
|
|
5030
5039
|
const getSearchHeaderVirtualDom = (flags, message, searchInputErrorMessage, matchCount, focus, limitHitWarning) => {
|
|
5031
5040
|
const dom = [parentNode, ...getSearchHeaderTopVirtualDom(flags, searchInputErrorMessage, matchCount, focus), ...getSearchHeaderDetailsVirtualDom(flags, message), ...getSearchHeaderLimitHitVirtualDom(limitHitWarning)];
|
|
@@ -5037,10 +5046,10 @@ const getSearchInputErrorVirtualDom = errorMessage => {
|
|
|
5037
5046
|
return [];
|
|
5038
5047
|
}
|
|
5039
5048
|
return [{
|
|
5040
|
-
|
|
5049
|
+
childCount: 1,
|
|
5041
5050
|
className: SearchInputError,
|
|
5042
5051
|
role: Alert,
|
|
5043
|
-
|
|
5052
|
+
type: Div
|
|
5044
5053
|
}, text(errorMessage)];
|
|
5045
5054
|
};
|
|
5046
5055
|
|
|
@@ -5051,19 +5060,19 @@ const getScrollBarVirtualDom = (scrollBarHeight, scrollBarY, scrollBarValue) =>
|
|
|
5051
5060
|
return [];
|
|
5052
5061
|
}
|
|
5053
5062
|
return [{
|
|
5054
|
-
|
|
5055
|
-
|
|
5063
|
+
ariaControls: TreeItems,
|
|
5064
|
+
ariaValueNow: scrollBarValue,
|
|
5056
5065
|
childCount: 1,
|
|
5066
|
+
className: mergeClassNames(ScrollBar, ScrollBarVertical),
|
|
5057
5067
|
onPointerDown: HandleScrollBarPointerDown,
|
|
5058
5068
|
role: ScrollBar$1,
|
|
5059
|
-
|
|
5060
|
-
ariaValueNow: scrollBarValue
|
|
5069
|
+
type: Div
|
|
5061
5070
|
}, {
|
|
5062
|
-
|
|
5071
|
+
childCount: 0,
|
|
5063
5072
|
className: ScrollBarThumb,
|
|
5064
5073
|
height: scrollBarHeight,
|
|
5065
5074
|
translate: `0 ${scrollBarY}px`,
|
|
5066
|
-
|
|
5075
|
+
type: Div
|
|
5067
5076
|
}];
|
|
5068
5077
|
};
|
|
5069
5078
|
|
|
@@ -5081,9 +5090,9 @@ const getAriaExpanded = expanded => {
|
|
|
5081
5090
|
};
|
|
5082
5091
|
|
|
5083
5092
|
const badge = {
|
|
5084
|
-
|
|
5093
|
+
childCount: 1,
|
|
5085
5094
|
className: mergeClassNames(Badge, SourceControlBadge),
|
|
5086
|
-
|
|
5095
|
+
type: Div
|
|
5087
5096
|
};
|
|
5088
5097
|
const getBadgeVirtualDom = badgeText => {
|
|
5089
5098
|
if (!badgeText) {
|
|
@@ -5093,22 +5102,22 @@ const getBadgeVirtualDom = badgeText => {
|
|
|
5093
5102
|
};
|
|
5094
5103
|
|
|
5095
5104
|
const chevronDownVirtualDom = {
|
|
5096
|
-
|
|
5105
|
+
childCount: 0,
|
|
5097
5106
|
className: mergeClassNames(Chevron, MaskIconChevronDown),
|
|
5098
|
-
|
|
5107
|
+
type: Div
|
|
5099
5108
|
};
|
|
5100
5109
|
const chevronRightVirtualDom = {
|
|
5101
|
-
|
|
5110
|
+
childCount: 0,
|
|
5102
5111
|
className: mergeClassNames(Chevron, MaskIconChevronRight),
|
|
5103
|
-
|
|
5112
|
+
type: Div
|
|
5104
5113
|
};
|
|
5105
5114
|
|
|
5106
5115
|
const getChevronVirtualDom = expanded => {
|
|
5107
5116
|
switch (expanded) {
|
|
5108
|
-
case Expanded:
|
|
5109
|
-
return [chevronDownVirtualDom];
|
|
5110
5117
|
case Collapsed:
|
|
5111
5118
|
return [chevronRightVirtualDom];
|
|
5119
|
+
case Expanded:
|
|
5120
|
+
return [chevronDownVirtualDom];
|
|
5112
5121
|
default:
|
|
5113
5122
|
return [];
|
|
5114
5123
|
}
|
|
@@ -5116,11 +5125,11 @@ const getChevronVirtualDom = expanded => {
|
|
|
5116
5125
|
|
|
5117
5126
|
const getFileIconVirtualDom = icon => {
|
|
5118
5127
|
return {
|
|
5119
|
-
|
|
5128
|
+
childCount: 0,
|
|
5120
5129
|
className: FileIcon,
|
|
5121
|
-
src: icon,
|
|
5122
5130
|
role: None$2,
|
|
5123
|
-
|
|
5131
|
+
src: icon,
|
|
5132
|
+
type: Img
|
|
5124
5133
|
};
|
|
5125
5134
|
};
|
|
5126
5135
|
|
|
@@ -5132,24 +5141,24 @@ const getIconsVirtualDom = icon => {
|
|
|
5132
5141
|
};
|
|
5133
5142
|
|
|
5134
5143
|
const deleted = {
|
|
5135
|
-
|
|
5144
|
+
childCount: 1,
|
|
5136
5145
|
className: HighlightDeleted,
|
|
5137
|
-
|
|
5146
|
+
type: Del
|
|
5138
5147
|
};
|
|
5139
5148
|
const inserted = {
|
|
5140
|
-
|
|
5149
|
+
childCount: 1,
|
|
5141
5150
|
className: HighlightInserted,
|
|
5142
|
-
|
|
5151
|
+
type: Ins
|
|
5143
5152
|
};
|
|
5144
5153
|
const highlighted = {
|
|
5145
|
-
|
|
5154
|
+
childCount: 1,
|
|
5146
5155
|
className: Highlight,
|
|
5147
|
-
|
|
5156
|
+
type: Span
|
|
5148
5157
|
};
|
|
5149
5158
|
const label1 = {
|
|
5150
|
-
|
|
5159
|
+
childCount: 1,
|
|
5151
5160
|
className: mergeClassNames(Label, Grow),
|
|
5152
|
-
|
|
5161
|
+
type: Div
|
|
5153
5162
|
};
|
|
5154
5163
|
const label3 = {
|
|
5155
5164
|
...label1,
|
|
@@ -5193,18 +5202,18 @@ const getChildCount = (icon, expanded, badgeText) => {
|
|
|
5193
5202
|
};
|
|
5194
5203
|
|
|
5195
5204
|
const closeIcon = {
|
|
5196
|
-
|
|
5205
|
+
childCount: 0,
|
|
5197
5206
|
className: CloseMaskIcon,
|
|
5198
|
-
|
|
5207
|
+
type: Div
|
|
5199
5208
|
};
|
|
5200
5209
|
const getSearchRemoveVirtualDom = () => {
|
|
5201
5210
|
const title = remove();
|
|
5202
5211
|
const dom = [{
|
|
5203
|
-
|
|
5212
|
+
childCount: 1,
|
|
5204
5213
|
className: SearchRemove,
|
|
5205
5214
|
name: Remove,
|
|
5206
|
-
|
|
5207
|
-
|
|
5215
|
+
title,
|
|
5216
|
+
type: Button$2
|
|
5208
5217
|
}, closeIcon];
|
|
5209
5218
|
return dom;
|
|
5210
5219
|
};
|
|
@@ -5220,34 +5229,34 @@ const PaddingRight = '12px';
|
|
|
5220
5229
|
|
|
5221
5230
|
const getSearchResultVirtualDom = rowInfo => {
|
|
5222
5231
|
const {
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5232
|
+
badgeText,
|
|
5233
|
+
depth,
|
|
5234
|
+
expanded,
|
|
5235
|
+
focused,
|
|
5227
5236
|
icon,
|
|
5228
|
-
|
|
5237
|
+
matchLength,
|
|
5238
|
+
matchStart,
|
|
5229
5239
|
posInSet,
|
|
5230
|
-
depth,
|
|
5231
5240
|
replacement,
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5241
|
+
setSize,
|
|
5242
|
+
text: displayText,
|
|
5243
|
+
title
|
|
5235
5244
|
} = rowInfo;
|
|
5236
5245
|
const childCount = getChildCount(icon, expanded, badgeText);
|
|
5237
5246
|
const dom = [{
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
title,
|
|
5242
|
-
ariaSetSize: setSize,
|
|
5247
|
+
ariaDescription: '',
|
|
5248
|
+
ariaExpanded: getAriaExpanded(expanded),
|
|
5249
|
+
ariaLabel: title,
|
|
5243
5250
|
ariaLevel: depth,
|
|
5244
5251
|
ariaPosInSet: posInSet,
|
|
5245
|
-
|
|
5246
|
-
ariaDescription: '',
|
|
5252
|
+
ariaSetSize: setSize,
|
|
5247
5253
|
childCount,
|
|
5254
|
+
className: getSearchResultClassName(focused),
|
|
5248
5255
|
paddingLeft: getPaddingLeft(depth),
|
|
5249
5256
|
paddingRight: PaddingRight,
|
|
5250
|
-
|
|
5257
|
+
role: TreeItem$1,
|
|
5258
|
+
title,
|
|
5259
|
+
type: Div
|
|
5251
5260
|
}, ...getChevronVirtualDom(expanded), ...getIconsVirtualDom(icon), ...getLabelVirtualDom(displayText, matchLength, matchStart, replacement), ...getBadgeVirtualDom(badgeText), ...getSearchRemoveVirtualDom()];
|
|
5252
5261
|
return dom;
|
|
5253
5262
|
};
|
|
@@ -5255,27 +5264,28 @@ const getSearchResultVirtualDom = rowInfo => {
|
|
|
5255
5264
|
const getTreeItemsVirtualDom = (visibleItems, deltaY, itemHeight) => {
|
|
5256
5265
|
const pixelOffset = deltaY % itemHeight;
|
|
5257
5266
|
return [{
|
|
5258
|
-
type: Div,
|
|
5259
|
-
className: TreeItems$1,
|
|
5260
5267
|
childCount: visibleItems.length,
|
|
5261
|
-
|
|
5268
|
+
className: TreeItems$1,
|
|
5269
|
+
id: TreeItems,
|
|
5262
5270
|
onBlur: HandleListBlur,
|
|
5263
|
-
|
|
5271
|
+
onClick: HandleClick,
|
|
5264
5272
|
onContextMenu: HandleListContextMenu,
|
|
5265
|
-
|
|
5266
|
-
top: `${-pixelOffset}px
|
|
5273
|
+
onWheel: HandleWheel,
|
|
5274
|
+
top: `${-pixelOffset}px`,
|
|
5275
|
+
// TODO use dynamic css instead
|
|
5276
|
+
type: Div
|
|
5267
5277
|
}, ...visibleItems.flatMap(getSearchResultVirtualDom)];
|
|
5268
5278
|
};
|
|
5269
5279
|
|
|
5270
5280
|
const getSearchResultsVirtualDom = (visibleItems, focusOutline, scrollbarHeight, scrollBarY, scrollBarValue, deltaY, itemHeight) => {
|
|
5271
5281
|
const childCount = scrollbarHeight === 0 ? 1 : 2;
|
|
5272
5282
|
return [{
|
|
5273
|
-
|
|
5283
|
+
childCount,
|
|
5274
5284
|
className: mergeClassNames(Viewlet, List$1, Tree, focusOutline ? FocusOutline : Empty$1),
|
|
5285
|
+
onBlur: HandleListBlur,
|
|
5275
5286
|
role: Tree$1,
|
|
5276
5287
|
tabIndex: 0,
|
|
5277
|
-
|
|
5278
|
-
onBlur: HandleListBlur
|
|
5288
|
+
type: Div
|
|
5279
5289
|
// TODO renable this when dom diffing is supported
|
|
5280
5290
|
// onPointerDown: HandleListPointerDown,
|
|
5281
5291
|
// onFocus: HandleListFocus,
|
|
@@ -5287,9 +5297,9 @@ const getSearchVirtualDom = (visibleItems, flags, message, focusOutline, searchI
|
|
|
5287
5297
|
const errorDom = getSearchInputErrorVirtualDom(searchInputErrorMessage);
|
|
5288
5298
|
const childCount = 2 + (errorDom.length > 0 ? 1 : 0);
|
|
5289
5299
|
return [{
|
|
5290
|
-
|
|
5300
|
+
childCount,
|
|
5291
5301
|
className,
|
|
5292
|
-
|
|
5302
|
+
type: Div
|
|
5293
5303
|
}, ...getSearchHeaderVirtualDom(flags, message, searchInputErrorMessage, matchCount, focus, limitHitWarning), ...errorDom, ...getSearchResultsVirtualDom(visibleItems, focusOutline, scrollBarHeight, scrollBarY, scrollBarValue, deltaY, itemHeight)];
|
|
5294
5304
|
};
|
|
5295
5305
|
|
|
@@ -5321,22 +5331,22 @@ const renderExcludeValue = (oldState, newState) => {
|
|
|
5321
5331
|
|
|
5322
5332
|
const getRenderer = diffType => {
|
|
5323
5333
|
switch (diffType) {
|
|
5324
|
-
case
|
|
5325
|
-
return
|
|
5334
|
+
case RenderExcludeValue:
|
|
5335
|
+
return renderExcludeValue;
|
|
5326
5336
|
case RenderFocus:
|
|
5327
5337
|
return renderFocus;
|
|
5328
|
-
case
|
|
5329
|
-
return
|
|
5338
|
+
case RenderFocusContext:
|
|
5339
|
+
return renderFocusContext;
|
|
5330
5340
|
case RenderIncludeValue:
|
|
5331
5341
|
return renderIncludeValue;
|
|
5332
|
-
case RenderExcludeValue:
|
|
5333
|
-
return renderExcludeValue;
|
|
5334
5342
|
case RenderItems:
|
|
5335
5343
|
return renderItems;
|
|
5336
|
-
case
|
|
5337
|
-
return
|
|
5344
|
+
case RenderReplaceValue:
|
|
5345
|
+
return renderReplacement;
|
|
5338
5346
|
case RenderSelections:
|
|
5339
5347
|
return renderSelections;
|
|
5348
|
+
case RenderValue:
|
|
5349
|
+
return renderValue;
|
|
5340
5350
|
default:
|
|
5341
5351
|
throw new Error('unknown renderer');
|
|
5342
5352
|
}
|
|
@@ -5353,8 +5363,8 @@ const applyRender = (oldState, newState, diffResult) => {
|
|
|
5353
5363
|
|
|
5354
5364
|
const render2 = (uid, diffResult) => {
|
|
5355
5365
|
const {
|
|
5356
|
-
|
|
5357
|
-
|
|
5366
|
+
newState,
|
|
5367
|
+
oldState
|
|
5358
5368
|
} = get$1(uid);
|
|
5359
5369
|
set(uid, newState, newState);
|
|
5360
5370
|
const commands = applyRender(oldState, newState, diffResult);
|
|
@@ -5365,10 +5375,10 @@ const Button = 1;
|
|
|
5365
5375
|
|
|
5366
5376
|
const getIconVirtualDom = (icon, type = Div) => {
|
|
5367
5377
|
return {
|
|
5368
|
-
|
|
5378
|
+
childCount: 0,
|
|
5369
5379
|
className: mergeClassNames(MaskIcon, `MaskIcon${icon}`),
|
|
5370
5380
|
role: None$2,
|
|
5371
|
-
|
|
5381
|
+
type
|
|
5372
5382
|
};
|
|
5373
5383
|
};
|
|
5374
5384
|
|
|
@@ -5380,18 +5390,18 @@ const getClassName = enabled => {
|
|
|
5380
5390
|
};
|
|
5381
5391
|
const getActionButtonVirtualDom = action => {
|
|
5382
5392
|
const {
|
|
5383
|
-
|
|
5393
|
+
enabled,
|
|
5384
5394
|
icon,
|
|
5385
|
-
|
|
5386
|
-
|
|
5395
|
+
id,
|
|
5396
|
+
label
|
|
5387
5397
|
} = action;
|
|
5388
5398
|
const className = getClassName(enabled);
|
|
5389
5399
|
return [{
|
|
5390
|
-
|
|
5400
|
+
childCount: 1,
|
|
5391
5401
|
className,
|
|
5392
|
-
title: label,
|
|
5393
5402
|
name: id,
|
|
5394
|
-
|
|
5403
|
+
title: label,
|
|
5404
|
+
type: Button$2
|
|
5395
5405
|
}, getIconVirtualDom(icon)];
|
|
5396
5406
|
};
|
|
5397
5407
|
|
|
@@ -5406,11 +5416,11 @@ const getActionVirtualDom = action => {
|
|
|
5406
5416
|
|
|
5407
5417
|
const getActionsVirtualDom = actions => {
|
|
5408
5418
|
return [{
|
|
5409
|
-
|
|
5419
|
+
childCount: actions.length,
|
|
5410
5420
|
className: Actions,
|
|
5421
|
+
onClick: HandleActionClick,
|
|
5411
5422
|
role: ToolBar,
|
|
5412
|
-
|
|
5413
|
-
onClick: HandleActionClick
|
|
5423
|
+
type: Div
|
|
5414
5424
|
}, ...actions.flatMap(getActionVirtualDom)];
|
|
5415
5425
|
};
|
|
5416
5426
|
|
|
@@ -5422,45 +5432,45 @@ const Refresh = 'Refresh';
|
|
|
5422
5432
|
|
|
5423
5433
|
const getActions = state => {
|
|
5424
5434
|
const {
|
|
5425
|
-
|
|
5426
|
-
|
|
5435
|
+
replacement,
|
|
5436
|
+
value
|
|
5427
5437
|
} = state;
|
|
5428
5438
|
const bothEmpty = value === '' && replacement === '';
|
|
5429
5439
|
return [{
|
|
5430
|
-
|
|
5431
|
-
|
|
5440
|
+
command: 'refresh',
|
|
5441
|
+
enabled: true,
|
|
5432
5442
|
icon: Refresh,
|
|
5433
5443
|
id: Refresh$1,
|
|
5434
|
-
|
|
5435
|
-
|
|
5444
|
+
label: refresh$1(),
|
|
5445
|
+
type: Button
|
|
5436
5446
|
}, {
|
|
5437
|
-
type: Button,
|
|
5438
|
-
label: clearSearchResults(),
|
|
5439
|
-
icon: ClearAll,
|
|
5440
5447
|
command: 'clearSearchResults',
|
|
5448
|
+
enabled: !bothEmpty,
|
|
5449
|
+
icon: ClearAll,
|
|
5441
5450
|
id: ClearAll$1,
|
|
5442
|
-
|
|
5451
|
+
label: clearSearchResults(),
|
|
5452
|
+
type: Button
|
|
5443
5453
|
}, {
|
|
5444
|
-
type: Button,
|
|
5445
|
-
label: openNewSearchEditor(),
|
|
5446
|
-
icon: NewFile,
|
|
5447
5454
|
command: '',
|
|
5455
|
+
enabled: true,
|
|
5456
|
+
icon: NewFile,
|
|
5448
5457
|
id: OpenSearchEditor,
|
|
5449
|
-
|
|
5458
|
+
label: openNewSearchEditor(),
|
|
5459
|
+
type: Button
|
|
5450
5460
|
}, {
|
|
5451
|
-
type: Button,
|
|
5452
|
-
label: viewAsTree$1(),
|
|
5453
|
-
icon: ListFlat,
|
|
5454
5461
|
command: '',
|
|
5462
|
+
enabled: true,
|
|
5463
|
+
icon: ListFlat,
|
|
5455
5464
|
id: ViewAsTree,
|
|
5456
|
-
|
|
5465
|
+
label: viewAsTree$1(),
|
|
5466
|
+
type: Button
|
|
5457
5467
|
}, {
|
|
5458
|
-
type: Button,
|
|
5459
|
-
label: collapseAll(),
|
|
5460
|
-
icon: CollapseAll,
|
|
5461
5468
|
command: '',
|
|
5469
|
+
enabled: true,
|
|
5470
|
+
icon: CollapseAll,
|
|
5462
5471
|
id: CollapseAll$1,
|
|
5463
|
-
|
|
5472
|
+
label: collapseAll(),
|
|
5473
|
+
type: Button
|
|
5464
5474
|
}];
|
|
5465
5475
|
};
|
|
5466
5476
|
|
|
@@ -5541,23 +5551,14 @@ const renderEventListeners = () => {
|
|
|
5541
5551
|
}];
|
|
5542
5552
|
};
|
|
5543
5553
|
|
|
5544
|
-
const getDom = state => {
|
|
5545
|
-
const displayResults = getDisplayResults(state.listItems, state.itemHeight, state.fileCount, state.value, state.minLineY, state.maxLineY, state.replacement, state.icons, state.listFocusedIndex, state.collapsedPaths, state.items);
|
|
5546
|
-
const focusOutline = state.listFocused && state.listFocusedIndex === -1;
|
|
5547
|
-
const scrollBarValue = state.deltaY / state.finalDeltaY * 100;
|
|
5548
|
-
const scrollBarY = getScrollBarY$1(state.deltaY, state.finalDeltaY, state.height - state.headerHeight, state.scrollBarHeight);
|
|
5549
|
-
const dom = getSearchVirtualDom(displayResults, state.flags, state.message, focusOutline, state.searchInputErrorMessage, state.scrollBarHeight, scrollBarY, scrollBarValue, state.deltaY, state.itemHeight, state.matchCount, state.limitHitWarning, state.focus);
|
|
5550
|
-
return dom;
|
|
5551
|
-
};
|
|
5552
|
-
|
|
5553
5554
|
// TODO cache rendered dom so that it can be used for dom diffing
|
|
5554
5555
|
const renderIncremental = uid => {
|
|
5555
5556
|
const {
|
|
5556
|
-
|
|
5557
|
-
|
|
5557
|
+
newState,
|
|
5558
|
+
oldState
|
|
5558
5559
|
} = get$1(uid);
|
|
5559
|
-
const oldDom =
|
|
5560
|
-
const newDom =
|
|
5560
|
+
const oldDom = renderItems(oldState, oldState);
|
|
5561
|
+
const newDom = renderItems(newState, newState);
|
|
5561
5562
|
const patches = diff$1(oldDom, newDom);
|
|
5562
5563
|
return patches;
|
|
5563
5564
|
};
|
|
@@ -5595,8 +5596,8 @@ const replaceAllAndPrompt = async (workspacePath, items, replacement, matchCount
|
|
|
5595
5596
|
const confirmAccept = replace();
|
|
5596
5597
|
const confirmText = getReplaceAllConfirmText(matchCount, fileCount, replacement);
|
|
5597
5598
|
const shouldReplace = await prompt(confirmText, {
|
|
5598
|
-
|
|
5599
|
-
|
|
5599
|
+
confirmMessage: confirmAccept,
|
|
5600
|
+
title: confirmTitle
|
|
5600
5601
|
});
|
|
5601
5602
|
if (!shouldReplace) {
|
|
5602
5603
|
return false;
|
|
@@ -5621,26 +5622,26 @@ const rerender = state => {
|
|
|
5621
5622
|
|
|
5622
5623
|
const saveState = state => {
|
|
5623
5624
|
const {
|
|
5624
|
-
value,
|
|
5625
|
-
replacement,
|
|
5626
|
-
flags,
|
|
5627
|
-
includeValue,
|
|
5628
|
-
excludeValue,
|
|
5629
|
-
history,
|
|
5630
5625
|
collapsedPaths,
|
|
5626
|
+
excludeValue,
|
|
5627
|
+
flags,
|
|
5631
5628
|
focus,
|
|
5632
|
-
|
|
5629
|
+
history,
|
|
5630
|
+
includeValue,
|
|
5631
|
+
listFocused,
|
|
5632
|
+
replacement,
|
|
5633
|
+
value
|
|
5633
5634
|
} = state;
|
|
5634
5635
|
return {
|
|
5635
|
-
value,
|
|
5636
|
-
replacement,
|
|
5637
|
-
flags,
|
|
5638
|
-
includeValue,
|
|
5639
|
-
excludeValue,
|
|
5640
|
-
history,
|
|
5641
5636
|
collapsedPaths,
|
|
5637
|
+
excludeValue,
|
|
5638
|
+
flags,
|
|
5642
5639
|
focus,
|
|
5643
|
-
|
|
5640
|
+
history,
|
|
5641
|
+
includeValue,
|
|
5642
|
+
listFocused,
|
|
5643
|
+
replacement,
|
|
5644
|
+
value
|
|
5644
5645
|
};
|
|
5645
5646
|
};
|
|
5646
5647
|
|
|
@@ -5719,9 +5720,9 @@ const getNewHistory = (history, newValue) => {
|
|
|
5719
5720
|
const submit = state => {
|
|
5720
5721
|
const newHistory = getNewHistory(state.history, state.value);
|
|
5721
5722
|
return handleUpdate(state, {
|
|
5722
|
-
|
|
5723
|
+
history: newHistory,
|
|
5723
5724
|
inputSource: User,
|
|
5724
|
-
|
|
5725
|
+
value: state.value
|
|
5725
5726
|
});
|
|
5726
5727
|
};
|
|
5727
5728
|
|
|
@@ -5729,41 +5730,42 @@ const Keyboard = -1;
|
|
|
5729
5730
|
|
|
5730
5731
|
const handleContextMenuKeyboard = async state => {
|
|
5731
5732
|
const {
|
|
5733
|
+
uid,
|
|
5732
5734
|
x,
|
|
5733
|
-
y
|
|
5734
|
-
uid
|
|
5735
|
+
y
|
|
5735
5736
|
} = state; // TODO
|
|
5736
5737
|
await show2(uid, Search$1, x, y, {
|
|
5737
|
-
|
|
5738
|
-
|
|
5738
|
+
index: 0,
|
|
5739
|
+
// TODO pass proper index
|
|
5740
|
+
menuId: Search$1
|
|
5739
5741
|
});
|
|
5740
5742
|
return state;
|
|
5741
5743
|
};
|
|
5742
5744
|
|
|
5743
5745
|
const handleContextMenuMouseAt = async (state, eventX, eventY) => {
|
|
5744
5746
|
const {
|
|
5745
|
-
uid,
|
|
5746
|
-
x,
|
|
5747
|
-
y,
|
|
5748
|
-
itemHeight,
|
|
5749
5747
|
deltaY,
|
|
5750
5748
|
flags,
|
|
5751
|
-
|
|
5749
|
+
itemHeight,
|
|
5750
|
+
listItems,
|
|
5751
|
+
uid,
|
|
5752
|
+
x,
|
|
5753
|
+
y
|
|
5752
5754
|
} = state;
|
|
5753
5755
|
const topHeight = getTopHeight(flags);
|
|
5754
5756
|
const index = getListIndex(eventX, eventY, x, y, deltaY, itemHeight, topHeight, listItems.length);
|
|
5755
5757
|
const {
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
+
newState,
|
|
5759
|
+
oldState
|
|
5758
5760
|
} = get$1(uid);
|
|
5759
5761
|
set(uid, oldState, {
|
|
5760
5762
|
...newState,
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
+
focusedIndex: index,
|
|
5764
|
+
listFocusedIndex: index
|
|
5763
5765
|
});
|
|
5764
5766
|
await show2(uid, Search$1, x, y, {
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
+
index,
|
|
5768
|
+
menuId: Search$1
|
|
5767
5769
|
});
|
|
5768
5770
|
return state;
|
|
5769
5771
|
};
|
|
@@ -5789,6 +5791,7 @@ const commandMap = {
|
|
|
5789
5791
|
'TextSearch.collapseDetails': wrapCommand(collapseDetails),
|
|
5790
5792
|
'TextSearch.copy': wrapCommand(copy$1),
|
|
5791
5793
|
'TextSearch.copyPath': wrapCommand(copyPath$1),
|
|
5794
|
+
'TextSearch.create': create,
|
|
5792
5795
|
'TextSearch.diff2': diff2,
|
|
5793
5796
|
'TextSearch.dismissItem': wrapCommand(dismissItem),
|
|
5794
5797
|
'TextSearch.expandDetails': wrapCommand(expandDetails),
|
|
@@ -5814,7 +5817,10 @@ const commandMap = {
|
|
|
5814
5817
|
'TextSearch.focusReplaceValuePrevious': wrapCommand(focusReplaceValuePrevious),
|
|
5815
5818
|
'TextSearch.focusSearchValue': wrapCommand(focusSearchValue$1),
|
|
5816
5819
|
'TextSearch.focusSearchValueNext': wrapCommand(focusSearchValueNext),
|
|
5820
|
+
'TextSearch.getCommandIds': getCommandIds,
|
|
5821
|
+
'TextSearch.getKeyBindings': getKeyBindings,
|
|
5817
5822
|
'TextSearch.getMenuEntries': wrapGetter(getMenuEntries),
|
|
5823
|
+
'TextSearch.getMenuEntryIds': getMenuEntryIds,
|
|
5818
5824
|
'TextSearch.handleActionClick': wrapCommand(handleActionClick),
|
|
5819
5825
|
'TextSearch.handleClickAt': wrapCommand(handleClickAt),
|
|
5820
5826
|
'TextSearch.handleContextMenu': wrapCommand(handleContextMenu),
|
|
@@ -5845,6 +5851,8 @@ const commandMap = {
|
|
|
5845
5851
|
'TextSearch.handleScrollBarMove': wrapCommand(handleScrollBarMove),
|
|
5846
5852
|
'TextSearch.handleSharedInput': wrapCommand(handleSharedInput),
|
|
5847
5853
|
'TextSearch.handleWheel': wrapCommand(handleWheel),
|
|
5854
|
+
// not wrapped
|
|
5855
|
+
'TextSearch.initialize': initialize,
|
|
5848
5856
|
'TextSearch.loadContent': wrapCommand(loadContent),
|
|
5849
5857
|
'TextSearch.nextHistoryResult': wrapCommand(nextHistoryResult),
|
|
5850
5858
|
'TextSearch.openSearchEditor': wrapCommand(openSearchEditor),
|
|
@@ -5852,12 +5860,22 @@ const commandMap = {
|
|
|
5852
5860
|
'TextSearch.refresh': wrapCommand(refresh),
|
|
5853
5861
|
'TextSearch.removeCurrent': wrapCommand(removeCurrent),
|
|
5854
5862
|
'TextSearch.removeIndex': wrapCommand(removeIndex),
|
|
5863
|
+
'TextSearch.render2': render2,
|
|
5864
|
+
'TextSearch.renderActions': wrapGetter(renderActions),
|
|
5865
|
+
'TextSearch.renderEventListeners': renderEventListeners,
|
|
5866
|
+
'TextSearch.renderIncremental': renderIncremental,
|
|
5855
5867
|
'TextSearch.replaceAll': wrapCommand(replaceAll),
|
|
5868
|
+
// TODO needed?
|
|
5869
|
+
'TextSearch.replaceAllAndPrompt': replaceAllAndPrompt,
|
|
5856
5870
|
'TextSearch.replaceAllInFile': wrapCommand(replaceAllInFile),
|
|
5857
5871
|
'TextSearch.rerender': rerender,
|
|
5872
|
+
'TextSearch.restoreState': restoreState,
|
|
5873
|
+
'TextSearch.saveState': wrapGetter(saveState),
|
|
5858
5874
|
'TextSearch.selectIndex': wrapCommand(selectIndex),
|
|
5859
5875
|
'TextSearch.setLimit': wrapCommand(setLimit),
|
|
5860
5876
|
'TextSearch.submit': wrapCommand(submit),
|
|
5877
|
+
'TextSearch.terminate': terminate,
|
|
5878
|
+
'TextSearch.textSearch': textSearch$6,
|
|
5861
5879
|
'TextSearch.toggleMatchCase': wrapCommand(toggleMatchCase),
|
|
5862
5880
|
'TextSearch.toggleMatchWholeWord': wrapCommand(toggleMatchWholeWord),
|
|
5863
5881
|
'TextSearch.toggleOpenEditors': wrapCommand(toggleOpenEditors),
|
|
@@ -5866,23 +5884,7 @@ const commandMap = {
|
|
|
5866
5884
|
'TextSearch.toggleSearchDetails': wrapCommand(toggleDetailsExpanded),
|
|
5867
5885
|
'TextSearch.toggleUseIgnoreFiles': wrapCommand(toggleUseIgnoreFiles),
|
|
5868
5886
|
'TextSearch.toggleUseRegularExpression': wrapCommand(toggleUseRegularExpression),
|
|
5869
|
-
'TextSearch.viewAsTree': wrapCommand(viewAsTree)
|
|
5870
|
-
// not wrapped
|
|
5871
|
-
'TextSearch.initialize': initialize,
|
|
5872
|
-
'TextSearch.create': create,
|
|
5873
|
-
'TextSearch.getCommandIds': getCommandIds,
|
|
5874
|
-
'TextSearch.getKeyBindings': getKeyBindings,
|
|
5875
|
-
'TextSearch.render2': render2,
|
|
5876
|
-
'TextSearch.renderEventListeners': renderEventListeners,
|
|
5877
|
-
'TextSearch.renderIncremental': renderIncremental,
|
|
5878
|
-
'TextSearch.restoreState': restoreState,
|
|
5879
|
-
'TextSearch.saveState': wrapGetter(saveState),
|
|
5880
|
-
'TextSearch.renderActions': wrapGetter(renderActions),
|
|
5881
|
-
'TextSearch.terminate': terminate,
|
|
5882
|
-
'TextSearch.getMenuEntryIds': getMenuEntryIds,
|
|
5883
|
-
// TODO needed?
|
|
5884
|
-
'TextSearch.replaceAllAndPrompt': replaceAllAndPrompt,
|
|
5885
|
-
'TextSearch.textSearch': textSearch$6
|
|
5887
|
+
'TextSearch.viewAsTree': wrapCommand(viewAsTree)
|
|
5886
5888
|
};
|
|
5887
5889
|
|
|
5888
5890
|
const textSearch$5 = async (scheme, root, query) => {
|
|
@@ -5890,24 +5892,24 @@ const textSearch$5 = async (scheme, root, query) => {
|
|
|
5890
5892
|
string(query);
|
|
5891
5893
|
const results = await invoke$1('ExtensionHostTextSearch.executeTextSearchProvider', scheme, query);
|
|
5892
5894
|
return {
|
|
5893
|
-
|
|
5894
|
-
|
|
5895
|
+
limitHit: false,
|
|
5896
|
+
results
|
|
5895
5897
|
};
|
|
5896
5898
|
};
|
|
5897
5899
|
|
|
5898
5900
|
const textSearch$4 = async (scheme, root, query, options, assetDir) => {
|
|
5899
5901
|
const results = await invoke$1('ExtensionHostTextSearch.textSearchFetch', scheme, root, query, options, assetDir);
|
|
5900
5902
|
return {
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
+
limitHit: false,
|
|
5904
|
+
results
|
|
5903
5905
|
};
|
|
5904
5906
|
};
|
|
5905
5907
|
|
|
5906
5908
|
const textSearch$3 = async (scheme, root, query) => {
|
|
5907
5909
|
const results = await invoke$1('ExtensionHostTextSearch.textSearchHtml', scheme, root, query);
|
|
5908
5910
|
return {
|
|
5909
|
-
|
|
5910
|
-
|
|
5911
|
+
limitHit: false,
|
|
5912
|
+
results
|
|
5911
5913
|
};
|
|
5912
5914
|
};
|
|
5913
5915
|
|
|
@@ -5922,8 +5924,8 @@ const textSearch$2 = async (scheme, root, query, options, assetDir) => {
|
|
|
5922
5924
|
} catch {
|
|
5923
5925
|
const results = await invoke$1('ExtensionHostTextSearch.textSearchMemory', scheme, root, query, options, assetDir);
|
|
5924
5926
|
return {
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
+
limitHit: false,
|
|
5928
|
+
results
|
|
5927
5929
|
};
|
|
5928
5930
|
}
|
|
5929
5931
|
};
|
|
@@ -5940,16 +5942,16 @@ const textSearch$1 = async (scheme, root, query, options, assetDir, platform) =>
|
|
|
5940
5942
|
if (platform === Remote || platform === Electron) {
|
|
5941
5943
|
const result = await invoke('TextSearch.search', actualOptions);
|
|
5942
5944
|
return {
|
|
5943
|
-
|
|
5944
|
-
|
|
5945
|
+
limitHit: result.limitHit,
|
|
5946
|
+
results: result.results
|
|
5945
5947
|
};
|
|
5946
5948
|
}
|
|
5947
5949
|
// TODO always create search process messageport rpc to have one api, in web can send the messageport to renderer worker
|
|
5948
5950
|
const result = await invoke$1('SearchProcess.invoke', 'TextSearch.search', actualOptions);
|
|
5949
5951
|
// TODO api is weird
|
|
5950
5952
|
return {
|
|
5951
|
-
|
|
5952
|
-
|
|
5953
|
+
limitHit: result.limitHit,
|
|
5954
|
+
results: result.results
|
|
5953
5955
|
};
|
|
5954
5956
|
};
|
|
5955
5957
|
|
|
@@ -5967,20 +5969,20 @@ const textSearch = async (scheme, root, query) => {
|
|
|
5967
5969
|
}
|
|
5968
5970
|
}
|
|
5969
5971
|
return {
|
|
5970
|
-
|
|
5971
|
-
|
|
5972
|
+
limitHit: false,
|
|
5973
|
+
results
|
|
5972
5974
|
};
|
|
5973
5975
|
};
|
|
5974
5976
|
|
|
5975
5977
|
const textSearchProviderMap = {
|
|
5976
5978
|
'': textSearch$1,
|
|
5977
5979
|
// TODO deprecate/remove workspaces without scheme
|
|
5978
|
-
|
|
5979
|
-
web: textSearch,
|
|
5980
|
+
default: textSearch$5,
|
|
5980
5981
|
fetch: textSearch$4,
|
|
5982
|
+
file: textSearch$1,
|
|
5981
5983
|
html: textSearch$3,
|
|
5982
5984
|
memfs: textSearch$2,
|
|
5983
|
-
|
|
5985
|
+
web: textSearch
|
|
5984
5986
|
};
|
|
5985
5987
|
|
|
5986
5988
|
const listen = async () => {
|