hyperlist 1.2.5 → 1.2.6

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/hyperlist +166 -26
  3. data/hyperlist.gemspec +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1bfa281e52d034a301cc645167ff71600f11bbb718b6220ff97ba1df74feed97
4
- data.tar.gz: 67ef0888bfad609aea9260b07c538cba47ac219e70aec504f568b7fbea00d6cb
3
+ metadata.gz: bbd169877052f1ab57f546b6dbd8cdcc8c7f32bff29fdabb0722e529827e8139
4
+ data.tar.gz: f3e095c33a6cc73df1d0e04f8d77dd0e07f35510a50a98b2a372ca76b19a65a9
5
5
  SHA512:
6
- metadata.gz: 0f932ad62217a97698953ff73930ce28a54d7abe67510eeadbfb1e84ea2a64421a66d3239e2badde5bd7fd19e920d3c916b378a792e1f87c97549298867c0d17
7
- data.tar.gz: 8fe1a8f377ec7775e024030e3119121727935225da24517dd77e72079ca17969cef632ff320259fdb80a6c93d4b044c51493571a42f2b0bd7ff45c6a7cb7c3c4
6
+ metadata.gz: 8299b5c733b268225f56ea4eb1e8bcd3af25aa970baa999b9213f2b0561314dcf07a9223610c36ba95fe31a5acc5a92a631a3878489bfa4281de8a5b7e52426c
7
+ data.tar.gz: e24fcb589303ce626689de3a946d9f1db02b8b01fdf0142a8f3bb7b3b962ef41f3af799030b4b2b7fe03fc83231638398a102881ce66a3b5015be61c2d13d065
data/hyperlist CHANGED
@@ -1283,38 +1283,116 @@ class HyperListApp
1283
1283
  end
1284
1284
 
1285
1285
  def move_up
1286
- max_items = get_visible_items.length - 1
1287
-
1288
- if @current == 0
1289
- # Wrap around to last item
1290
- @current = max_items
1286
+ if @presentation_mode
1287
+ # In presentation mode, we need to handle navigation differently
1288
+ visible_before = get_visible_items
1289
+
1290
+ if @current == 0
1291
+ # Wrap around to last item
1292
+ target_index = visible_before.length - 1
1293
+ else
1294
+ target_index = @current - 1
1295
+ end
1296
+
1297
+ # Get the actual item we want to move to
1298
+ target_item = visible_before[target_index]
1299
+ target_real_idx = get_real_index(target_item)
1300
+
1301
+ # Update presentation focus for the target item
1302
+ @current = target_index
1303
+ update_presentation_focus
1304
+
1305
+ # Now find where the target item ended up after reorganization
1306
+ visible_after = get_visible_items
1307
+ visible_after.each_with_index do |item, idx|
1308
+ if get_real_index(item) == target_real_idx
1309
+ @current = idx
1310
+ break
1311
+ end
1312
+ end
1291
1313
  else
1292
- @current = [@current - 1, 0].max
1314
+ # Normal mode navigation
1315
+ max_items = get_visible_items.length - 1
1316
+
1317
+ if @current == 0
1318
+ # Wrap around to last item
1319
+ @current = max_items
1320
+ else
1321
+ @current = [@current - 1, 0].max
1322
+ end
1293
1323
  end
1294
-
1295
- update_presentation_focus if @presentation_mode
1296
1324
  end
1297
1325
 
1298
1326
  def move_down
1299
- max = get_visible_items.length - 1
1300
-
1301
- if @current == max
1302
- # Wrap around to first item
1303
- @current = 0
1327
+ if @presentation_mode
1328
+ # In presentation mode, we need to handle navigation differently
1329
+ visible_before = get_visible_items
1330
+ max = visible_before.length - 1
1331
+
1332
+ if @current == max
1333
+ # Wrap around to first item
1334
+ target_index = 0
1335
+ else
1336
+ target_index = @current + 1
1337
+ end
1338
+
1339
+ # Get the actual item we want to move to
1340
+ target_item = visible_before[target_index]
1341
+ target_real_idx = get_real_index(target_item)
1342
+
1343
+ # Update presentation focus for the target item
1344
+ @current = target_index
1345
+ update_presentation_focus
1346
+
1347
+ # Now find where the target item ended up after reorganization
1348
+ visible_after = get_visible_items
1349
+ visible_after.each_with_index do |item, idx|
1350
+ if get_real_index(item) == target_real_idx
1351
+ @current = idx
1352
+ break
1353
+ end
1354
+ end
1304
1355
  else
1305
- @current = [@current + 1, max].min
1356
+ # Normal mode navigation
1357
+ max = get_visible_items.length - 1
1358
+
1359
+ if @current == max
1360
+ # Wrap around to first item
1361
+ @current = 0
1362
+ else
1363
+ @current = [@current + 1, max].min
1364
+ end
1306
1365
  end
1307
-
1308
- update_presentation_focus if @presentation_mode
1309
1366
  end
1310
1367
 
1311
1368
  def page_up
1312
1369
  if @split_view && @active_pane == :split
1313
1370
  @split_current = [@split_current - (@split_pane.h - 1), 0].max
1371
+ elsif @presentation_mode
1372
+ # In presentation mode, handle page navigation differently
1373
+ visible_before = get_visible_items
1374
+ target_index = [@current - (@main.h - 1), 0].max
1375
+
1376
+ if target_index < visible_before.length
1377
+ target_item = visible_before[target_index]
1378
+ target_real_idx = get_real_index(target_item)
1379
+
1380
+ @current = target_index
1381
+ update_presentation_focus
1382
+
1383
+ # Find where the target item ended up
1384
+ visible_after = get_visible_items
1385
+ visible_after.each_with_index do |item, idx|
1386
+ if get_real_index(item) == target_real_idx
1387
+ @current = idx
1388
+ break
1389
+ end
1390
+ end
1391
+ end
1392
+ @offset = [@offset - (@main.h - 1), 0].max
1314
1393
  else
1315
1394
  @current = [@current - (@main.h - 1), 0].max
1316
1395
  @offset = [@offset - (@main.h - 1), 0].max
1317
- update_presentation_focus if @presentation_mode
1318
1396
  end
1319
1397
  end
1320
1398
 
@@ -1322,10 +1400,29 @@ class HyperListApp
1322
1400
  if @split_view && @active_pane == :split
1323
1401
  max = get_visible_split_items.length - 1
1324
1402
  @split_current = [@split_current + (@split_pane.h - 1), max].min
1403
+ elsif @presentation_mode
1404
+ # In presentation mode, handle page navigation differently
1405
+ visible_before = get_visible_items
1406
+ max = visible_before.length - 1
1407
+ target_index = [@current + (@main.h - 1), max].min
1408
+
1409
+ target_item = visible_before[target_index]
1410
+ target_real_idx = get_real_index(target_item)
1411
+
1412
+ @current = target_index
1413
+ update_presentation_focus
1414
+
1415
+ # Find where the target item ended up
1416
+ visible_after = get_visible_items
1417
+ visible_after.each_with_index do |item, idx|
1418
+ if get_real_index(item) == target_real_idx
1419
+ @current = idx
1420
+ break
1421
+ end
1422
+ end
1325
1423
  else
1326
1424
  max = get_visible_items.length - 1
1327
1425
  @current = [@current + (@main.h - 1), max].min
1328
- update_presentation_focus if @presentation_mode
1329
1426
  end
1330
1427
  end
1331
1428
 
@@ -1336,12 +1433,39 @@ class HyperListApp
1336
1433
  current_level = visible[@current]["level"]
1337
1434
  return if current_level == 0
1338
1435
 
1339
- # Search upward for parent
1340
- (@current - 1).downto(0) do |i|
1341
- if visible[i]["level"] < current_level
1342
- @current = i
1343
- update_presentation_focus if @presentation_mode
1344
- break
1436
+ if @presentation_mode
1437
+ # Find parent and navigate to it properly
1438
+ target_idx = nil
1439
+ (@current - 1).downto(0) do |i|
1440
+ if visible[i]["level"] < current_level
1441
+ target_idx = i
1442
+ break
1443
+ end
1444
+ end
1445
+
1446
+ if target_idx
1447
+ target_item = visible[target_idx]
1448
+ target_real_idx = get_real_index(target_item)
1449
+
1450
+ @current = target_idx
1451
+ update_presentation_focus
1452
+
1453
+ # Find where the target item ended up
1454
+ visible_after = get_visible_items
1455
+ visible_after.each_with_index do |item, idx|
1456
+ if get_real_index(item) == target_real_idx
1457
+ @current = idx
1458
+ break
1459
+ end
1460
+ end
1461
+ end
1462
+ else
1463
+ # Search upward for parent
1464
+ (@current - 1).downto(0) do |i|
1465
+ if visible[i]["level"] < current_level
1466
+ @current = i
1467
+ break
1468
+ end
1345
1469
  end
1346
1470
  end
1347
1471
  end
@@ -1352,8 +1476,24 @@ class HyperListApp
1352
1476
 
1353
1477
  current_level = visible[@current]["level"]
1354
1478
  if visible[@current + 1]["level"] > current_level
1355
- @current += 1
1356
- update_presentation_focus if @presentation_mode
1479
+ if @presentation_mode
1480
+ target_item = visible[@current + 1]
1481
+ target_real_idx = get_real_index(target_item)
1482
+
1483
+ @current += 1
1484
+ update_presentation_focus
1485
+
1486
+ # Find where the target item ended up
1487
+ visible_after = get_visible_items
1488
+ visible_after.each_with_index do |item, idx|
1489
+ if get_real_index(item) == target_real_idx
1490
+ @current = idx
1491
+ break
1492
+ end
1493
+ end
1494
+ else
1495
+ @current += 1
1496
+ end
1357
1497
  end
1358
1498
  end
1359
1499
 
data/hyperlist.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "hyperlist"
3
- spec.version = "1.2.5"
3
+ spec.version = "1.2.6"
4
4
  spec.authors = ["Geir Isene"]
5
5
  spec.email = ["g@isene.com"]
6
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hyperlist
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.5
4
+ version: 1.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene