@hexdspace/react 0.1.42 → 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
@@ -3371,10 +3371,6 @@ var VimHandleKeyUseCase = class {
3371
3371
  const scopeId = this.query.getActiveScope();
3372
3372
  if (!scopeId) return;
3373
3373
  this.selection.exitSelectMode(scopeId);
3374
- const activeKey = this.query.getActiveRegion(scopeId);
3375
- if (activeKey) {
3376
- this.afterRegionChange(activeKey);
3377
- }
3378
3374
  const st = this.stateByScope.get(scopeId);
3379
3375
  if (st) {
3380
3376
  st.count = "";
@@ -3392,7 +3388,7 @@ var VimHandleKeyUseCase = class {
3392
3388
  if (dir === "left" || dir === "right") {
3393
3389
  const interDir = dir;
3394
3390
  if (meta && !meta.inter.has(interDir)) return;
3395
- const nextKey = this.regions.neighbor(scopeId, activeKey, interDir, count);
3391
+ const nextKey = this.findNextNonEmptyRegion(scopeId, activeKey, interDir, count);
3396
3392
  if (!nextKey) return;
3397
3393
  const prevIndex = this.getCursorIndex(activeKey);
3398
3394
  this.selection.setActiveRegion(nextKey);
@@ -3455,6 +3451,24 @@ var VimHandleKeyUseCase = class {
3455
3451
  const index = items.indexOf(cursor);
3456
3452
  return index >= 0 ? index : null;
3457
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
+ }
3458
3472
  resolveInterRegionFallback(fallback, prevIndex) {
3459
3473
  if (fallback.kind === "sameIndex") {
3460
3474
  if (prevIndex === null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hexdspace/react",
3
- "version": "0.1.42",
3
+ "version": "0.1.44",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",