@lvce-editor/text-search-view 1.14.1 → 1.14.3

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.
@@ -1135,7 +1135,7 @@ const createMockRpc = ({
1135
1135
  };
1136
1136
 
1137
1137
  const rpcs = Object.create(null);
1138
- const set$7 = (id, rpc) => {
1138
+ const set$8 = (id, rpc) => {
1139
1139
  rpcs[id] = rpc;
1140
1140
  };
1141
1141
  const get$1 = id => {
@@ -1168,7 +1168,7 @@ const create$3 = rpcId => {
1168
1168
  const mockRpc = createMockRpc({
1169
1169
  commandMap
1170
1170
  });
1171
- set$7(rpcId, mockRpc);
1171
+ set$8(rpcId, mockRpc);
1172
1172
  // @ts-ignore
1173
1173
  mockRpc[Symbol.dispose] = () => {
1174
1174
  remove$2(rpcId);
@@ -1177,7 +1177,7 @@ const create$3 = rpcId => {
1177
1177
  return mockRpc;
1178
1178
  },
1179
1179
  set(rpc) {
1180
- set$7(rpcId, rpc);
1180
+ set$8(rpcId, rpc);
1181
1181
  }
1182
1182
  };
1183
1183
  };
@@ -1447,6 +1447,7 @@ const DialogWorker = 7014;
1447
1447
  const IconThemeWorker = 7009;
1448
1448
  const RendererProcess = 1670;
1449
1449
  const RendererWorker = 1;
1450
+ const TextMeasurementWorker = 7011;
1450
1451
  const TextSearchWorker = 7010;
1451
1452
 
1452
1453
  const File$1 = 1;
@@ -1476,35 +1477,35 @@ const FocusToggleDetails = 1010;
1476
1477
  const FocusToggleReplace = 1020;
1477
1478
 
1478
1479
  const {
1479
- invoke: invoke$5,
1480
- set: set$6
1480
+ invoke: invoke$6,
1481
+ set: set$7
1481
1482
  } = create$3(DialogWorker);
1482
1483
 
1483
1484
  const {
1484
- invoke: invoke$4,
1485
- set: set$5
1485
+ invoke: invoke$5,
1486
+ set: set$6
1486
1487
  } = create$3(IconThemeWorker);
1487
1488
  const getIcons = async iconRequests => {
1488
1489
  // @ts-ignore
1489
- return invoke$4('IconTheme.getIcons', iconRequests);
1490
+ return invoke$5('IconTheme.getIcons', iconRequests);
1490
1491
  };
1491
1492
 
1492
1493
  const {
1493
- invoke: invoke$3,
1494
- set: set$4
1494
+ invoke: invoke$4,
1495
+ set: set$5
1495
1496
  } = create$3(RendererProcess);
1496
1497
 
1497
1498
  const {
1498
- invoke: invoke$2,
1499
+ invoke: invoke$3,
1499
1500
  invokeAndTransfer,
1500
- set: set$3
1501
+ set: set$4
1501
1502
  } = create$3(RendererWorker);
1502
1503
  const showContextMenu2 = async (uid, menuId, x, y, args) => {
1503
1504
  number(uid);
1504
1505
  number(menuId);
1505
1506
  number(x);
1506
1507
  number(y);
1507
- await invoke$2('ContextMenu.show2', uid, menuId, x, y, args);
1508
+ await invoke$3('ContextMenu.show2', uid, menuId, x, y, args);
1508
1509
  };
1509
1510
  const sendMessagePortToTextSearchWorker = async (port, rpcId) => {
1510
1511
  const command = 'HandleMessagePort.handleMessagePort';
@@ -1519,30 +1520,34 @@ const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
1519
1520
  await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
1520
1521
  };
1521
1522
  const handleWorkspaceRefresh = async () => {
1522
- return invoke$2('Layout.handleWorkspaceRefresh');
1523
+ return invoke$3('Layout.handleWorkspaceRefresh');
1523
1524
  };
1524
1525
  const writeClipBoardText = async text => {
1525
- await invoke$2('ClipBoard.writeText', /* text */text);
1526
+ await invoke$3('ClipBoard.writeText', /* text */text);
1527
+ };
1528
+ const sendMessagePortToTextMeasurementWorker = async port => {
1529
+ const command = 'TextMeasurement.handleMessagePort';
1530
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToTextMeasurementWorker', port, command, 0);
1526
1531
  };
1527
1532
  const getPreference = async key => {
1528
- return await invoke$2('Preferences.get', key);
1533
+ return await invoke$3('Preferences.get', key);
1529
1534
  };
1530
1535
  const openUri$1 = async (uri, focus, options) => {
1531
- await invoke$2('Main.openUri', uri, focus, options);
1536
+ await invoke$3('Main.openUri', uri, focus, options);
1532
1537
  };
1533
1538
 
1534
1539
  const {
1535
- invoke: invoke$1,
1536
- set: set$2
1540
+ invoke: invoke$2,
1541
+ set: set$3
1537
1542
  } = create$3(TextSearchWorker);
1538
1543
  const getIncrementalResults = async (searchId, minLineY, maxLineY) => {
1539
- return invoke$1('TextSearch.getIncrementalResults', searchId, minLineY, maxLineY);
1544
+ return invoke$2('TextSearch.getIncrementalResults', searchId, minLineY, maxLineY);
1540
1545
  };
1541
1546
  const search$1 = async (...args) => {
1542
- return invoke$1('TextSearch.search', ...args);
1547
+ return invoke$2('TextSearch.search', ...args);
1543
1548
  };
1544
1549
  const searchIncremental = async (...args) => {
1545
- return invoke$1('TextSearch.searchIncremental', ...args);
1550
+ return invoke$2('TextSearch.searchIncremental', ...args);
1546
1551
  };
1547
1552
 
1548
1553
  const toCommandId = key => {
@@ -2066,17 +2071,27 @@ const diffTree = (oldNodes, newNodes) => {
2066
2071
  const User = 1;
2067
2072
  const Script = 2;
2068
2073
 
2074
+ const Minimum = 30;
2075
+ const VerticalPadding = 13;
2076
+
2069
2077
  const clearSearchResults$1 = state => {
2078
+ const {
2079
+ headerHeight: oldHeaderHeight,
2080
+ messageHeight: oldMessageHeight
2081
+ } = state;
2082
+ const headerHeight = oldHeaderHeight + Minimum - oldMessageHeight;
2070
2083
  return {
2071
2084
  ...state,
2072
2085
  focus: FocusSearchInput,
2073
2086
  focusSource: Script,
2087
+ headerHeight,
2074
2088
  inputSource: Script,
2075
2089
  items: [],
2076
2090
  limitHit: false,
2077
2091
  limitHitWarning: '',
2078
2092
  maxLineY: 0,
2079
2093
  message: '',
2094
+ messageHeight: Minimum,
2080
2095
  minLineY: 0,
2081
2096
  replacement: '',
2082
2097
  searchInputErrorMessage: '',
@@ -2331,22 +2346,49 @@ const getTopHeight = flags => {
2331
2346
  const getHeaderHeightForFlags = (headerHeight, oldFlags, newFlags) => {
2332
2347
  const oldTopHeight = getTopHeight(oldFlags);
2333
2348
  const newTopHeight = getTopHeight(newFlags);
2334
- const warningHeight = Math.max(headerHeight - oldTopHeight, 0);
2335
- return newTopHeight + warningHeight;
2349
+ const additionalHeight = Math.max(headerHeight - oldTopHeight, 0);
2350
+ return newTopHeight + additionalHeight;
2336
2351
  };
2337
2352
 
2338
- const collapseDetails = state => {
2353
+ const invoke$1 = (method, ...params) => {
2354
+ return get$1(TextMeasurementWorker).invoke(method, ...params);
2355
+ };
2356
+ const set$2 = rpc => {
2357
+ set$8(TextMeasurementWorker, rpc);
2358
+ };
2359
+
2360
+ const SearchMessageFontFamily = 'system-ui';
2361
+ const SearchMessageFontSize = 13;
2362
+ const SearchMessageLineHeight = 13;
2363
+ const SearchMessageCollapsedHorizontalSpace = 52;
2364
+ const SearchMessageExpandedHorizontalSpace = 30;
2365
+ const getSearchMessageHeight = async (message, width, flags) => {
2366
+ if (!message) {
2367
+ return Minimum;
2368
+ }
2369
+ const horizontalSpace = hasDetailsExpanded(flags) ? SearchMessageExpandedHorizontalSpace : SearchMessageCollapsedHorizontalSpace;
2370
+ const availableWidth = Math.max(width - horizontalSpace, 1);
2371
+ const textHeight = await invoke$1('TextMeasurement.measureTextBlockHeight', message, SearchMessageFontFamily, SearchMessageFontSize, SearchMessageLineHeight, availableWidth);
2372
+ return Math.max(textHeight + VerticalPadding, Minimum);
2373
+ };
2374
+
2375
+ const collapseDetails = async state => {
2339
2376
  const {
2340
2377
  flags,
2341
- headerHeight
2378
+ headerHeight,
2379
+ message,
2380
+ messageHeight: oldMessageHeight,
2381
+ width
2342
2382
  } = state;
2343
2383
  const newFlags = flags & -33;
2384
+ const messageHeight = await getSearchMessageHeight(message, width, newFlags);
2344
2385
  return {
2345
2386
  ...state,
2346
2387
  flags: newFlags,
2347
2388
  focus: FocusSearchInput,
2348
2389
  focusSource: Script,
2349
- headerHeight: getHeaderHeightForFlags(headerHeight, flags, newFlags)
2390
+ headerHeight: getHeaderHeightForFlags(headerHeight, flags, newFlags) + messageHeight - oldMessageHeight,
2391
+ messageHeight
2350
2392
  };
2351
2393
  };
2352
2394
 
@@ -2367,7 +2409,7 @@ const writeText = async text => {
2367
2409
  await writeClipBoardText(text);
2368
2410
  };
2369
2411
  const readText = async () => {
2370
- return await invoke$2('ClipBoard.readText');
2412
+ return await invoke$3('ClipBoard.readText');
2371
2413
  };
2372
2414
 
2373
2415
  const getActualIndex$1 = state => {
@@ -2526,6 +2568,7 @@ const create = (uid, x, y, width, height, workspacePath, assetDir, itemHeight, v
2526
2568
  loaded: false,
2527
2569
  matchCount: 0,
2528
2570
  message: '',
2571
+ messageHeight: Minimum,
2529
2572
  platform,
2530
2573
  removeButtonRight: 0,
2531
2574
  removeButtonWidth: 20,
@@ -2563,7 +2606,7 @@ const create = (uid, x, y, width, height, workspacePath, assetDir, itemHeight, v
2563
2606
  };
2564
2607
 
2565
2608
  const isEqual$7 = (oldState, newState) => {
2566
- return oldState.deltaY === newState.deltaY && oldState.finalDeltaY === newState.finalDeltaY && oldState.height === newState.height && oldState.headerHeight === newState.headerHeight && oldState.itemHeight === newState.itemHeight && oldState.items === newState.items && oldState.loaded === newState.loaded;
2609
+ return oldState.deltaY === newState.deltaY && oldState.finalDeltaY === newState.finalDeltaY && oldState.height === newState.height && oldState.headerHeight === newState.headerHeight && oldState.itemHeight === newState.itemHeight && oldState.items === newState.items && oldState.messageHeight === newState.messageHeight && oldState.loaded === newState.loaded;
2567
2610
  };
2568
2611
 
2569
2612
  const isEqual$6 = (oldState, newState) => {
@@ -2652,6 +2695,20 @@ const getNewMinMax = (newItemsLength, minLineY, maxLineY, deltaY, itemHeight) =>
2652
2695
  };
2653
2696
  };
2654
2697
 
2698
+ const getSearchMessageLayout = async (state, message) => {
2699
+ const {
2700
+ flags,
2701
+ headerHeight,
2702
+ messageHeight: oldMessageHeight,
2703
+ width
2704
+ } = state;
2705
+ const messageHeight = await getSearchMessageHeight(message, width, flags);
2706
+ return {
2707
+ headerHeight: headerHeight + messageHeight - oldMessageHeight,
2708
+ messageHeight
2709
+ };
2710
+ };
2711
+
2655
2712
  // based on https://github.com/microsoft/vscode/blob/c0769274fa136b45799edeccc0d0a2f645b75caf/src/vs/base/common/arrays.ts#L625 (License MIT)
2656
2713
 
2657
2714
  const remove$1 = (array, index, deleteCount) => {
@@ -2817,8 +2874,12 @@ const RevealInExplorerView = 'Reveal in Explorer View';
2817
2874
  const ReplacingManyOccurrencesInManyFiles = 'Replacing {PH1} occurrences across {PH2} files…';
2818
2875
  const ReplacingManyOccurrencesInOneFile = 'Replacing {PH1} occurrences across 1 file…';
2819
2876
  const ReplacingOneOccurrenceInOneFile = 'Replacing 1 occurrence across 1 file…';
2877
+ const ReplacedManyOccurrencesInManyFilesNoValue = 'Replaced {PH1} occurrences across {PH2} files';
2820
2878
  const ReplacedManyOccurrencesInManyFiles = "Replaced {PH1} occurrences across {PH2} files with '{PH3}'";
2879
+ const ReplacedManyOccurrencesInOneFile = "Replaced {PH1} occurrences across 1 file with '{PH2}'";
2880
+ const ReplacedManyOccurrencesInOneFileNoValue = 'Replaced {PH1} occurrences across 1 file';
2821
2881
  const ReplacedOneOccurrenceInOneFile = "Replaced 1 occurrence across 1 file with '{PH1}'";
2882
+ const ReplacedOneOccurrenceInOneFileNoValue = 'Replaced 1 occurrence across 1 file';
2822
2883
  const ReplaceForHistory = 'Replace (⇅ for history)';
2823
2884
  const Search = 'Search';
2824
2885
  const SearchForHistory = 'Search (⇅ for history)';
@@ -2911,12 +2972,20 @@ const replacedOneOccurrenceInOneFile = replacement => {
2911
2972
  PH1: replacement
2912
2973
  });
2913
2974
  };
2975
+ const replacedOneOccurrenceInOneFileNoValue = () => {
2976
+ return i18nString(ReplacedOneOccurrenceInOneFileNoValue);
2977
+ };
2914
2978
  const replacedManyOccurrencesInOneFile = (matchCount, replacement) => {
2915
- return i18nString(ReplacedOneOccurrenceInOneFile, {
2979
+ return i18nString(ReplacedManyOccurrencesInOneFile, {
2916
2980
  PH1: matchCount,
2917
2981
  PH2: replacement
2918
2982
  });
2919
2983
  };
2984
+ const replacedManyOccurrencesInOneFileNoValue = matchCount => {
2985
+ return i18nString(ReplacedManyOccurrencesInOneFileNoValue, {
2986
+ PH1: matchCount
2987
+ });
2988
+ };
2920
2989
  const replacedManyOccurrencesInManyFiles = (matchCount, fileCount, replacement) => {
2921
2990
  return i18nString(ReplacedManyOccurrencesInManyFiles, {
2922
2991
  PH1: matchCount,
@@ -2924,6 +2993,12 @@ const replacedManyOccurrencesInManyFiles = (matchCount, fileCount, replacement)
2924
2993
  PH3: replacement
2925
2994
  });
2926
2995
  };
2996
+ const replacedManyOccurrencesInManyFilesNoValue = (matchCount, fileCount) => {
2997
+ return i18nString(ReplacedManyOccurrencesInManyFilesNoValue, {
2998
+ PH1: matchCount,
2999
+ PH2: fileCount
3000
+ });
3001
+ };
2927
3002
  const replacingOneOccurrenceInOneFile = () => {
2928
3003
  return i18nString(ReplacingOneOccurrenceInOneFile);
2929
3004
  };
@@ -3038,7 +3113,6 @@ const removeIndex = async (state, index) => {
3038
3113
  deltaY,
3039
3114
  fileCount,
3040
3115
  fileIconCache,
3041
- headerHeight,
3042
3116
  height,
3043
3117
  itemHeight,
3044
3118
  items,
@@ -3057,6 +3131,10 @@ const removeIndex = async (state, index) => {
3057
3131
  newMatchCount
3058
3132
  } = removeItemFromItems(items, index, matchCount, fileCount);
3059
3133
  const message = getStatusMessage(newMatchCount, newFileCount);
3134
+ const {
3135
+ headerHeight,
3136
+ messageHeight
3137
+ } = await getSearchMessageLayout(state, message);
3060
3138
  const {
3061
3139
  newDeltaY,
3062
3140
  newMaxLineY,
@@ -3078,6 +3156,7 @@ const removeIndex = async (state, index) => {
3078
3156
  fileCount: newFileCount,
3079
3157
  fileIconCache: newFileIconCache,
3080
3158
  finalDeltaY,
3159
+ headerHeight,
3081
3160
  icons,
3082
3161
  items: newItems,
3083
3162
  listFocusedIndex: newFocusedIndex,
@@ -3085,6 +3164,7 @@ const removeIndex = async (state, index) => {
3085
3164
  matchCount: newMatchCount,
3086
3165
  maxLineY: newMaxLineY,
3087
3166
  message,
3167
+ messageHeight,
3088
3168
  minLineY: newMinLineY,
3089
3169
  scrollBarHeight
3090
3170
  };
@@ -3128,18 +3208,23 @@ const expandCurrent = async state => {
3128
3208
  return applyCollapsedPaths(state, collapsedPaths.toSpliced(collapsedIndex, 1), actualIndex);
3129
3209
  };
3130
3210
 
3131
- const expandDetails = state => {
3211
+ const expandDetails = async state => {
3132
3212
  const {
3133
3213
  flags,
3134
- headerHeight
3214
+ headerHeight,
3215
+ message,
3216
+ messageHeight: oldMessageHeight,
3217
+ width
3135
3218
  } = state;
3136
3219
  const newFlags = flags | DetailsExpanded;
3220
+ const messageHeight = await getSearchMessageHeight(message, width, newFlags);
3137
3221
  return {
3138
3222
  ...state,
3139
3223
  flags: newFlags,
3140
3224
  focus: FocusSearchIncludeInput,
3141
3225
  focusSource: Script,
3142
- headerHeight: getHeaderHeightForFlags(headerHeight, flags, newFlags)
3226
+ headerHeight: getHeaderHeightForFlags(headerHeight, flags, newFlags) + messageHeight - oldMessageHeight,
3227
+ messageHeight
3143
3228
  };
3144
3229
  };
3145
3230
 
@@ -3592,7 +3677,7 @@ const openSearchEditor = async state => {
3592
3677
 
3593
3678
  const getSearchExcludes = async (fallback = []) => {
3594
3679
  try {
3595
- const value = await invoke$2('Preferences.get', 'search.exclude');
3680
+ const value = await invoke$3('Preferences.get', 'search.exclude');
3596
3681
  if (!value || typeof value !== 'object' || Array.isArray(value)) {
3597
3682
  return [];
3598
3683
  }
@@ -3634,6 +3719,7 @@ const handleUpdateEmpty = (state, update) => {
3634
3719
  matchCount: 0,
3635
3720
  maxLineY: 0,
3636
3721
  message: '',
3722
+ messageHeight: Minimum,
3637
3723
  minLineY: 0,
3638
3724
  scrollBarHeight: 0,
3639
3725
  scrollBarY: 0,
@@ -3647,14 +3733,19 @@ const handleUpdateError = async (state, update, error) => {
3647
3733
  ...state,
3648
3734
  ...update
3649
3735
  };
3736
+ const message = `${error}`;
3737
+ const messageHeight = await getSearchMessageHeight(message, partialNewState.width, partialNewState.flags);
3738
+ const headerHeight = partialNewState.headerHeight + messageHeight - partialNewState.messageHeight;
3650
3739
  return {
3651
3740
  ...partialNewState,
3652
3741
  fileCount: 0,
3742
+ headerHeight,
3653
3743
  items: [],
3654
3744
  listItems: [],
3655
3745
  matchCount: 0,
3656
3746
  maxLineY: 0,
3657
- message: `${error}`,
3747
+ message,
3748
+ messageHeight,
3658
3749
  minLineY: 0
3659
3750
  };
3660
3751
  };
@@ -3668,8 +3759,13 @@ const getProtocol = uri => {
3668
3759
  return '';
3669
3760
  };
3670
3761
 
3762
+ const getSearchHeaderHeight = (flags, messageHeight, warningHeight) => {
3763
+ const additionalMessageHeight = Math.max(messageHeight - Minimum, 0);
3764
+ return getTopHeight(flags) + additionalMessageHeight + warningHeight;
3765
+ };
3766
+
3671
3767
  const measureTextHeight = (text, fontFamily, fontSize, lineHeight, width) => {
3672
- return invoke$2('MeasureTextHeight.measureTextBlockHeight', text, fontFamily, fontSize, `${lineHeight}px`, width);
3768
+ return invoke$3('MeasureTextHeight.measureTextBlockHeight', text, fontFamily, fontSize, `${lineHeight}px`, width);
3673
3769
  };
3674
3770
 
3675
3771
  const SearchWarningFontFamily = 'system-ui';
@@ -3709,7 +3805,7 @@ const textSearch = async (root, query, options, assetDir, platform, searchId, ui
3709
3805
  if (!hasOpenEditors(options.flags)) {
3710
3806
  return search$1(root, query, options, assetDir, platform, searchId, uid);
3711
3807
  }
3712
- const openEditorUris = await invoke$2('GetActiveEditor.getOpenEditorUris');
3808
+ const openEditorUris = await invoke$3('GetActiveEditor.getOpenEditorUris');
3713
3809
  return search$1(root, query, {
3714
3810
  ...options,
3715
3811
  openEditorUris
@@ -3778,8 +3874,8 @@ const handleUpdateFull = async (state, update) => {
3778
3874
  } = getTextSearchResultCounts(results);
3779
3875
  const message = getStatusMessage(resultCount, fileCount);
3780
3876
  const limitHitWarning = limitHit ? theResultSetOnlyContainsASubSetOfMatches() : '';
3781
- const warningHeight = await getSearchWarningMessageHeight(limitHitWarning, width);
3782
- const headerHeight = getTopHeight(flags) + warningHeight;
3877
+ const [messageHeight, warningHeight] = await Promise.all([getSearchMessageHeight(message, width, flags), getSearchWarningMessageHeight(limitHitWarning, width)]);
3878
+ const headerHeight = getSearchHeaderHeight(flags, messageHeight, warningHeight);
3783
3879
  const total = results.length;
3784
3880
  const contentHeight = total * itemHeight;
3785
3881
  const listHeight = height - headerHeight;
@@ -3809,6 +3905,7 @@ const handleUpdateFull = async (state, update) => {
3809
3905
  matchCount: resultCount,
3810
3906
  maxLineY: maxLineY,
3811
3907
  message,
3908
+ messageHeight,
3812
3909
  minLineY: 0,
3813
3910
  scrollBarHeight,
3814
3911
  searchId,
@@ -3856,7 +3953,7 @@ const textSearchIncremental = async (root, query, options, assetDir, platform, s
3856
3953
  };
3857
3954
  set$1(uid, latest2.oldState, updatedState2);
3858
3955
  // @ts-ignore
3859
- await invoke$2('Search.rerender');
3956
+ await invoke$3('Search.rerender');
3860
3957
  await waitForNextFrame();
3861
3958
  }
3862
3959
  await resultPromise;
@@ -3980,19 +4077,20 @@ const handleUpdatePullBased = async (state, update) => {
3980
4077
  return state;
3981
4078
  }
3982
4079
  const limitHitWarning = limitHit ? theResultSetOnlyContainsASubSetOfMatches() : '';
3983
- const warningHeight = await getSearchWarningMessageHeight(limitHitWarning, width);
3984
- const headerHeight = getTopHeight(flags) + warningHeight;
3985
4080
  const {
3986
4081
  fileCount,
3987
4082
  resultCount
3988
4083
  } = getTextSearchResultCounts(latest.newState.items);
3989
4084
  const message = getStatusMessage(resultCount, fileCount);
4085
+ const [messageHeight, warningHeight] = await Promise.all([getSearchMessageHeight(message, width, flags), getSearchWarningMessageHeight(limitHitWarning, width)]);
4086
+ const headerHeight = getSearchHeaderHeight(flags, messageHeight, warningHeight);
3990
4087
  return {
3991
4088
  ...latest.newState,
3992
4089
  headerHeight,
3993
4090
  limitHit,
3994
4091
  limitHitWarning,
3995
- message
4092
+ message,
4093
+ messageHeight
3996
4094
  };
3997
4095
  };
3998
4096
 
@@ -4111,10 +4209,19 @@ const noop = state => {
4111
4209
  };
4112
4210
 
4113
4211
  const applyBulkReplacement = async bulkEdits => {
4114
- await invoke$2('BulkReplacement.applyBulkReplacement', bulkEdits);
4212
+ await invoke$3('BulkReplacement.applyBulkReplacement', bulkEdits);
4115
4213
  };
4116
4214
 
4117
4215
  const getReplacedMessage = (fileCount, replaceCount, replacement) => {
4216
+ if (replacement === '') {
4217
+ if (replaceCount === 1) {
4218
+ return replacedOneOccurrenceInOneFileNoValue();
4219
+ }
4220
+ if (fileCount === 1) {
4221
+ return replacedManyOccurrencesInOneFileNoValue(replaceCount);
4222
+ }
4223
+ return replacedManyOccurrencesInManyFilesNoValue(replaceCount, fileCount);
4224
+ }
4118
4225
  if (replaceCount === 1) {
4119
4226
  return replacedOneOccurrenceInOneFile(replacement);
4120
4227
  }
@@ -4172,12 +4279,12 @@ const getReplacingMessage = (fileCount, replaceCount) => {
4172
4279
  const missingDialogWorkerRelay = 'Command "SendMessagePortToExtensionHostWorker.sendMessagePortToDialogWorker" not found';
4173
4280
  const prompt = async (text, options) => {
4174
4281
  try {
4175
- return await invoke$5('ConfirmPrompt.prompt', text, options);
4282
+ return await invoke$6('ConfirmPrompt.prompt', text, options);
4176
4283
  } catch (error) {
4177
4284
  if (!String(error).includes(missingDialogWorkerRelay)) {
4178
4285
  throw error;
4179
4286
  }
4180
- return invoke$2('ConfirmPrompt.prompt', text, options);
4287
+ return invoke$3('ConfirmPrompt.prompt', text, options);
4181
4288
  }
4182
4289
  };
4183
4290
 
@@ -4253,7 +4360,6 @@ const replaceAllInFocusedFile = async (state, fileIndex) => {
4253
4360
  deltaY,
4254
4361
  fileCount,
4255
4362
  fileIconCache,
4256
- headerHeight,
4257
4363
  height,
4258
4364
  itemHeight,
4259
4365
  items,
@@ -4278,6 +4384,11 @@ const replaceAllInFocusedFile = async (state, fileIndex) => {
4278
4384
  newItems,
4279
4385
  newMatchCount
4280
4386
  } = removeItemFromItems(items, fileIndex, totalMatchCount, fileCount);
4387
+ const message = getReplacedMessage(1, matchCount, replacement);
4388
+ const {
4389
+ headerHeight,
4390
+ messageHeight
4391
+ } = await getSearchMessageLayout(state, message);
4281
4392
  const {
4282
4393
  newDeltaY,
4283
4394
  newMaxLineY,
@@ -4299,13 +4410,15 @@ const replaceAllInFocusedFile = async (state, fileIndex) => {
4299
4410
  fileCount: newFileCount,
4300
4411
  fileIconCache: newFileIconCache,
4301
4412
  finalDeltaY,
4413
+ headerHeight,
4302
4414
  icons,
4303
4415
  items: newItems,
4304
4416
  listFocusedIndex: newFocusedIndex,
4305
4417
  listItems: newItems,
4306
4418
  matchCount: newMatchCount,
4307
4419
  maxLineY: newMaxLineY,
4308
- message: getReplacedMessage(1, matchCount, replacement),
4420
+ message,
4421
+ messageHeight,
4309
4422
  minLineY: newMinLineY,
4310
4423
  scrollBarHeight
4311
4424
  };
@@ -4341,12 +4454,18 @@ const replaceAllConfirmed = async (state, fileIndex) => {
4341
4454
  await handleWorkspaceRefresh();
4342
4455
  const fileCount = bulkEdits.length;
4343
4456
  const message = getReplacedMessage(fileCount, matchCount, replacement);
4457
+ const {
4458
+ headerHeight,
4459
+ messageHeight
4460
+ } = await getSearchMessageLayout(state, message);
4344
4461
  return {
4345
4462
  ...state,
4463
+ headerHeight,
4346
4464
  items: [],
4347
4465
  listItems: [],
4348
4466
  maxLineY: 0,
4349
4467
  message,
4468
+ messageHeight,
4350
4469
  minLineY: 0
4351
4470
  };
4352
4471
  };
@@ -4374,11 +4493,13 @@ const replaceAllWithProgress = async context => {
4374
4493
  return;
4375
4494
  }
4376
4495
  const message = getReplacingMessage(fileCount, matchCount);
4496
+ const messageLayout = await getSearchMessageLayout(state, message);
4377
4497
  await context.updateState(latestState => ({
4378
4498
  ...latestState,
4499
+ ...messageLayout,
4379
4500
  message
4380
4501
  }));
4381
- await invoke$2('Search.rerender');
4502
+ await invoke$3('Search.rerender');
4382
4503
  const updatedState = await replaceAllConfirmed(context.getState(), fileIndex);
4383
4504
  await context.updateState(() => updatedState);
4384
4505
  };
@@ -4393,7 +4514,7 @@ const toggleContextLines = async state => {
4393
4514
  };
4394
4515
  };
4395
4516
 
4396
- const toggleDetailsExpanded = state => {
4517
+ const toggleDetailsExpanded = async state => {
4397
4518
  const {
4398
4519
  flags
4399
4520
  } = state;
@@ -4887,10 +5008,10 @@ const isConnected = () => {
4887
5008
  return connected;
4888
5009
  };
4889
5010
  const invoke = (method, ...params) => {
4890
- return invoke$3(method, ...params);
5011
+ return invoke$4(method, ...params);
4891
5012
  };
4892
5013
  const set = rpc => {
4893
- set$4(rpc);
5014
+ set$5(rpc);
4894
5015
  state.connected = true;
4895
5016
  };
4896
5017
 
@@ -4901,7 +5022,7 @@ const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess =
4901
5022
  throw new TypeError(`Viewlet command not found: ${command}`);
4902
5023
  }
4903
5024
  await fn(uid, ...args);
4904
- await invoke$2('Viewlet.requestRender', uid);
5025
+ await invoke$3('Viewlet.requestRender', uid);
4905
5026
  };
4906
5027
  const rpc = await create$7({
4907
5028
  commandMap: {
@@ -4915,7 +5036,7 @@ const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess =
4915
5036
  };
4916
5037
 
4917
5038
  const openFolder = async () => {
4918
- await invoke$2('Dialog.openFolder');
5039
+ await invoke$3('Dialog.openFolder');
4919
5040
  };
4920
5041
 
4921
5042
  const handleOpenFolderClick = async state => {
@@ -4926,7 +5047,6 @@ const handleOpenFolderClick = async state => {
4926
5047
  const handlePullResultsFound = async (state, resultSearchId, newResults) => {
4927
5048
  const {
4928
5049
  fileIconCache,
4929
- headerHeight,
4930
5050
  height,
4931
5051
  itemHeight,
4932
5052
  listItems,
@@ -4943,6 +5063,10 @@ const handlePullResultsFound = async (state, resultSearchId, newResults) => {
4943
5063
  resultCount
4944
5064
  } = getTextSearchResultCounts(allResults);
4945
5065
  const message = getStatusMessage(resultCount, fileCount);
5066
+ const {
5067
+ headerHeight,
5068
+ messageHeight
5069
+ } = await getSearchMessageLayout(state, message);
4946
5070
  const total = allResults.length;
4947
5071
  const contentHeight = total * itemHeight;
4948
5072
  const listHeight = height - headerHeight;
@@ -4961,6 +5085,7 @@ const handlePullResultsFound = async (state, resultSearchId, newResults) => {
4961
5085
  fileCount,
4962
5086
  fileIconCache: newFileIconCache,
4963
5087
  finalDeltaY,
5088
+ headerHeight,
4964
5089
  icons,
4965
5090
  items: allResults,
4966
5091
  listItems: allResults,
@@ -4968,12 +5093,13 @@ const handlePullResultsFound = async (state, resultSearchId, newResults) => {
4968
5093
  matchCount: resultCount,
4969
5094
  maxLineY,
4970
5095
  message,
5096
+ messageHeight,
4971
5097
  minLineY: 0,
4972
5098
  scrollBarHeight
4973
5099
  };
4974
5100
  const oldState = latest ? latest.oldState : state;
4975
5101
  set$1(uid, oldState, updatedState);
4976
- await invoke$2('Search.rerender');
5102
+ await invoke$3('Search.rerender');
4977
5103
  return state;
4978
5104
  };
4979
5105
 
@@ -4985,11 +5111,16 @@ const handleResize = async (state, x, y, width, height) => {
4985
5111
  const {
4986
5112
  deltaY,
4987
5113
  fileIconCache,
4988
- headerHeight,
5114
+ flags,
5115
+ headerHeight: oldHeaderHeight,
4989
5116
  itemHeight,
4990
5117
  listItems,
5118
+ message,
5119
+ messageHeight: oldMessageHeight,
4991
5120
  minimumSliderSize
4992
5121
  } = state;
5122
+ const messageHeight = await getSearchMessageHeight(message, width, flags);
5123
+ const headerHeight = oldHeaderHeight + messageHeight - oldMessageHeight;
4993
5124
  const total = listItems.length;
4994
5125
  const contentHeight = total * itemHeight;
4995
5126
  const listHeight = height - headerHeight;
@@ -5010,9 +5141,11 @@ const handleResize = async (state, x, y, width, height) => {
5010
5141
  deltaY: newDeltaY,
5011
5142
  fileIconCache: newFileIconCache,
5012
5143
  finalDeltaY,
5144
+ headerHeight,
5013
5145
  height,
5014
5146
  icons,
5015
5147
  maxLineY,
5148
+ messageHeight,
5016
5149
  minLineY,
5017
5150
  scrollBarHeight,
5018
5151
  scrollBarY,
@@ -5028,14 +5161,21 @@ const handleSharedInput = (state, name, value, inputSource = Script) => {
5028
5161
  };
5029
5162
 
5030
5163
  const handleWorkspaceChange = (state, workspacePath) => {
5164
+ const {
5165
+ headerHeight: oldHeaderHeight,
5166
+ messageHeight: oldMessageHeight
5167
+ } = state;
5168
+ const headerHeight = oldHeaderHeight + Minimum - oldMessageHeight;
5031
5169
  return {
5032
5170
  ...state,
5033
5171
  deltaY: 0,
5172
+ headerHeight,
5034
5173
  items: [],
5035
5174
  listItems: [],
5036
5175
  matchCount: 0,
5037
5176
  maxLineY: 0,
5038
5177
  message: '',
5178
+ messageHeight: Minimum,
5039
5179
  minLineY: 0,
5040
5180
  replacement: '',
5041
5181
  value: '',
@@ -5043,40 +5183,40 @@ const handleWorkspaceChange = (state, workspacePath) => {
5043
5183
  };
5044
5184
  };
5045
5185
 
5046
- const send$1 = async port => {
5186
+ const send$2 = async port => {
5047
5187
  await sendMessagePortToIconThemeWorker(port, 0);
5048
5188
  };
5049
5189
  const launchIconThemeWorker = async () => {
5050
5190
  // TODO connect to icon theme worker
5051
5191
  const rpc = await create$5({
5052
5192
  commandMap: {},
5053
- send: send$1
5193
+ send: send$2
5054
5194
  });
5055
5195
  return rpc;
5056
5196
  };
5057
5197
 
5058
5198
  const initializeIconThemeWorker = async () => {
5059
5199
  const rpc = await launchIconThemeWorker();
5060
- set$5(rpc);
5200
+ set$6(rpc);
5061
5201
  };
5062
5202
 
5063
5203
  const commandMap$1 = {
5064
5204
  'TextSearch.handlePullResultsFound': wrapCommand(handlePullResultsFound)
5065
5205
  };
5066
5206
 
5067
- const send = async port => {
5207
+ const send$1 = async port => {
5068
5208
  await sendMessagePortToTextSearchWorker(port, 0);
5069
5209
  };
5070
5210
  const launchTextSearchWorker = async () => {
5071
5211
  return create$5({
5072
5212
  commandMap: commandMap$1,
5073
- send
5213
+ send: send$1
5074
5214
  });
5075
5215
  };
5076
5216
 
5077
5217
  const initializeTextSearchWorker = async () => {
5078
5218
  const rpc = await launchTextSearchWorker();
5079
- set$2(rpc);
5219
+ set$3(rpc);
5080
5220
  };
5081
5221
 
5082
5222
  const initialize = async () => {
@@ -5618,6 +5758,7 @@ const loadContent = async (state, savedState) => {
5618
5758
  const {
5619
5759
  defaultExcludes: currentDefaultExcludes,
5620
5760
  limitHitWarning,
5761
+ messageHeight,
5621
5762
  width
5622
5763
  } = state;
5623
5764
  const {
@@ -5632,7 +5773,7 @@ const loadContent = async (state, savedState) => {
5632
5773
  const defaultExcludes = await getSearchExcludes(currentDefaultExcludes);
5633
5774
  const usePullBasedSearch = await getUsePullBasedSearch();
5634
5775
  const warningHeight = await getSearchWarningMessageHeight(limitHitWarning, width);
5635
- const headerHeight = getTopHeight(flags) + warningHeight;
5776
+ const headerHeight = getSearchHeaderHeight(flags, messageHeight, warningHeight);
5636
5777
  const update = {
5637
5778
  collapsedPaths: savedCollapsedPaths,
5638
5779
  defaultExcludes,
@@ -5900,11 +6041,12 @@ const getScrollBarThumbTopRule = scrollBarY => {
5900
6041
  transform: translateY(${roundedScrollBarY}px);
5901
6042
  }`;
5902
6043
  };
5903
- const getCss = (top, uniqueIndents, uniqueIndentRights, scrollBarHeight, scrollBarY, treeItemsTop, headerHeight = 0) => {
6044
+ const getCss = (top, uniqueIndents, uniqueIndentRights, scrollBarHeight, scrollBarY, treeItemsTop, headerHeight = 0, messageHeight = 30) => {
5904
6045
  const rules = [`.Search {
5905
6046
  --ScrollBarHeight: ${scrollBarHeight}px;
5906
6047
  --ScrollBarTop: ${scrollBarY}px;
5907
6048
  --TreeItemsTop: ${top}px;
6049
+ --SearchMessageHeight: ${messageHeight}px;
5908
6050
  }
5909
6051
 
5910
6052
  .SearchHeader {
@@ -5912,6 +6054,10 @@ const getCss = (top, uniqueIndents, uniqueIndentRights, scrollBarHeight, scrollB
5912
6054
  height: ${headerHeight}px;
5913
6055
  }
5914
6056
 
6057
+ .Search .SearchHeaderDetails {
6058
+ height: var(--SearchMessageHeight);
6059
+ }
6060
+
5915
6061
  .SearchWorkspaceMessageAction {
5916
6062
  appearance: none;
5917
6063
  background-color: transparent;
@@ -5966,6 +6112,7 @@ const PaddingRight = 12;
5966
6112
  const renderCss = (oldState, newState) => {
5967
6113
  const {
5968
6114
  headerHeight,
6115
+ messageHeight,
5969
6116
  uid
5970
6117
  } = newState;
5971
6118
  const viewModel = createViewModel(newState);
@@ -5973,7 +6120,7 @@ const renderCss = (oldState, newState) => {
5973
6120
  const uniqueIndents = getUniqueIndents(indents);
5974
6121
  const uniqueIndentRights = [PaddingRight];
5975
6122
  const treeItemsTop = viewModel.itemHeight === 0 ? 0 : Math.round(-(viewModel.deltaY % viewModel.itemHeight));
5976
- const css = getCss(0, uniqueIndents, uniqueIndentRights, viewModel.scrollBarHeight, viewModel.scrollBarY, treeItemsTop, headerHeight);
6123
+ const css = getCss(0, uniqueIndents, uniqueIndentRights, viewModel.scrollBarHeight, viewModel.scrollBarY, treeItemsTop, headerHeight, messageHeight);
5977
6124
  return [SetCss, uid, css];
5978
6125
  };
5979
6126
 
@@ -6734,16 +6881,16 @@ const renderSelections = (oldState, newState) => {
6734
6881
  };
6735
6882
 
6736
6883
  const renderValue = (oldState, newState) => {
6737
- return [SetValueByName, SearchValue, newState.value];
6884
+ return [SetValueByName, newState.uid, SearchValue, newState.value];
6738
6885
  };
6739
6886
  const renderReplacement = (oldState, newState) => {
6740
- return [SetValueByName, ReplaceValue, newState.replacement];
6887
+ return [SetValueByName, newState.uid, ReplaceValue, newState.replacement];
6741
6888
  };
6742
6889
  const renderIncludeValue = (oldState, newState) => {
6743
- return [SetValueByName, FilesToInclude, newState.includeValue];
6890
+ return [SetValueByName, newState.uid, FilesToInclude, newState.includeValue];
6744
6891
  };
6745
6892
  const renderExcludeValue = (oldState, newState) => {
6746
- return [SetValueByName, FilesToExclude, newState.excludeValue];
6893
+ return [SetValueByName, newState.uid, FilesToExclude, newState.excludeValue];
6747
6894
  };
6748
6895
 
6749
6896
  const getRenderer = diffType => {
@@ -7002,12 +7149,12 @@ const rerender = state => {
7002
7149
  };
7003
7150
 
7004
7151
  const revealInExplorerActual = async uri => {
7005
- await invoke$2('SideBar.show', 'Explorer');
7006
- const states = await invoke$2('Viewlet.getAllStates');
7152
+ await invoke$3('SideBar.show', 'Explorer');
7153
+ const states = await invoke$3('Viewlet.getAllStates');
7007
7154
  const viewlets = Object.values(states);
7008
7155
  const sideBar = viewlets.find(viewlet => viewlet.currentViewletId === 'Explorer');
7009
7156
  const explorerUid = Math.max(...viewlets.filter(viewlet => viewlet.parentUid === sideBar.uid).map(viewlet => viewlet.uid));
7010
- await invoke$2('Viewlet.executeViewletCommand', explorerUid, 'reveal', uri);
7157
+ await invoke$3('Viewlet.executeViewletCommand', explorerUid, 'reveal', uri);
7011
7158
  };
7012
7159
  const revealInExplorer = async (state, uri) => {
7013
7160
  await revealInExplorerActual(uri);
@@ -7305,17 +7452,28 @@ const commandMap = {
7305
7452
  'TextSearch.viewAsTree': wrapCommand(viewAsTree)
7306
7453
  };
7307
7454
 
7455
+ const send = port => {
7456
+ return sendMessagePortToTextMeasurementWorker(port);
7457
+ };
7458
+ const initializeTextMeasurementWorker = async () => {
7459
+ const rpc = await create$5({
7460
+ commandMap: {},
7461
+ send
7462
+ });
7463
+ set$2(rpc);
7464
+ };
7465
+
7308
7466
  const listen = async () => {
7309
7467
  registerCommands(commandMap);
7310
7468
  const rpc = await create$4({
7311
7469
  commandMap: commandMap
7312
7470
  });
7313
- set$3(rpc);
7314
- const dialogRpc = await create$5({
7471
+ set$4(rpc);
7472
+ const [dialogRpc] = await Promise.all([create$5({
7315
7473
  commandMap: {},
7316
7474
  send: sendMessagePortToDialogWorker
7317
- });
7318
- set$6(dialogRpc);
7475
+ }), initializeTextMeasurementWorker()]);
7476
+ set$7(dialogRpc);
7319
7477
  };
7320
7478
 
7321
7479
  const main = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/text-search-view",
3
- "version": "1.14.1",
3
+ "version": "1.14.3",
4
4
  "description": "Text Search View",
5
5
  "keywords": [
6
6
  "text-search"