@lvce-editor/extension-search-view 3.4.0 → 3.5.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.
@@ -1349,6 +1349,9 @@ const last = items => {
1349
1349
  const next = (items, index) => {
1350
1350
  return (index + 1) % items.length;
1351
1351
  };
1352
+ const previous = (items, index) => {
1353
+ return index === 0 ? items.length - 1 : index - 1;
1354
+ };
1352
1355
  const focusFirst = state => {
1353
1356
  const firstIndex = first();
1354
1357
  return focusIndex(state, firstIndex);
@@ -1390,6 +1393,17 @@ const focusNextPage = state => {
1390
1393
  const indexNextPage = Math.min(maxLineY + (maxLineY - minLineY) - 2, lastIndex(items));
1391
1394
  return focusIndex(state, indexNextPage);
1392
1395
  };
1396
+ const focusPrevious = state => {
1397
+ const {
1398
+ focusedIndex,
1399
+ items
1400
+ } = state;
1401
+ if (focusedIndex === 0 || focusedIndex === -1) {
1402
+ return state;
1403
+ }
1404
+ const previousIndex = previous(items, focusedIndex);
1405
+ return focusIndex(state, previousIndex);
1406
+ };
1393
1407
  const focusPreviousPage = state => {
1394
1408
  const {
1395
1409
  focusedIndex,
@@ -2416,6 +2430,7 @@ const commandMap = {
2416
2430
  'SearchExtensions.focusNext': wrapCommand(focusNext),
2417
2431
  'SearchExtensions.focusNextPage': wrapCommand(focusNextPage),
2418
2432
  'SearchExtensions.focusPreviousPage': wrapCommand(focusPreviousPage),
2433
+ 'SearchExtensions.focusPrevious': wrapCommand(focusPrevious),
2419
2434
  'SearchExtensions.getActions': getActions,
2420
2435
  'SearchExtensions.getCommandIds': getCommandIds,
2421
2436
  'SearchExtensions.getKeyBindings': getKeyBindings,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-search-view",
3
- "version": "3.4.0",
3
+ "version": "3.5.0",
4
4
  "description": "Extension Search View Worker",
5
5
  "license": "MIT",
6
6
  "author": "Lvce Editor",