@hexdspace/react 0.1.43 → 0.1.44

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/index.d.ts CHANGED
@@ -901,6 +901,7 @@ declare class VimHandleKeyUseCase {
901
901
  private afterCursorChange;
902
902
  private applyFallbackCursor;
903
903
  private getCursorIndex;
904
+ private findNextNonEmptyRegion;
904
905
  private resolveInterRegionFallback;
905
906
  }
906
907
 
package/dist/index.js CHANGED
@@ -3388,7 +3388,7 @@ var VimHandleKeyUseCase = class {
3388
3388
  if (dir === "left" || dir === "right") {
3389
3389
  const interDir = dir;
3390
3390
  if (meta && !meta.inter.has(interDir)) return;
3391
- const nextKey = this.regions.neighbor(scopeId, activeKey, interDir, count);
3391
+ const nextKey = this.findNextNonEmptyRegion(scopeId, activeKey, interDir, count);
3392
3392
  if (!nextKey) return;
3393
3393
  const prevIndex = this.getCursorIndex(activeKey);
3394
3394
  this.selection.setActiveRegion(nextKey);
@@ -3451,6 +3451,24 @@ var VimHandleKeyUseCase = class {
3451
3451
  const index = items.indexOf(cursor);
3452
3452
  return index >= 0 ? index : null;
3453
3453
  }
3454
+ findNextNonEmptyRegion(scopeId, activeKey, dir, count) {
3455
+ const regs = this.regions.list(scopeId);
3456
+ if (regs.length === 0) return null;
3457
+ const currentIndex = regs.findIndex((r) => r.key.regionId === activeKey.regionId);
3458
+ const start = currentIndex >= 0 ? currentIndex : 0;
3459
+ const step = dir === "right" ? 1 : -1;
3460
+ const moveBy = Math.max(1, count);
3461
+ const raw = start + step * moveBy;
3462
+ let idx = clamp3(raw, 0, regs.length - 1);
3463
+ while (idx >= 0 && idx < regs.length) {
3464
+ const key = regs[idx]?.key;
3465
+ if (key && this.getItems(key).length > 0) {
3466
+ return key;
3467
+ }
3468
+ idx += step;
3469
+ }
3470
+ return null;
3471
+ }
3454
3472
  resolveInterRegionFallback(fallback, prevIndex) {
3455
3473
  if (fallback.kind === "sameIndex") {
3456
3474
  if (prevIndex === null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hexdspace/react",
3
- "version": "0.1.43",
3
+ "version": "0.1.44",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",