@mariozechner/pi-tui 0.60.0 → 0.61.1
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/components/cancellable-loader.d.ts.map +1 -1
- package/dist/components/cancellable-loader.js +3 -3
- package/dist/components/cancellable-loader.js.map +1 -1
- package/dist/components/editor.d.ts.map +1 -1
- package/dist/components/editor.js +33 -33
- package/dist/components/editor.js.map +1 -1
- package/dist/components/input.d.ts.map +1 -1
- package/dist/components/input.js +19 -19
- package/dist/components/input.js.map +1 -1
- package/dist/components/select-list.d.ts.map +1 -1
- package/dist/components/select-list.js +6 -6
- package/dist/components/select-list.js.map +1 -1
- package/dist/components/settings-list.d.ts.map +1 -1
- package/dist/components/settings-list.js +6 -6
- package/dist/components/settings-list.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/keybindings.d.ts +187 -33
- package/dist/keybindings.d.ts.map +1 -1
- package/dist/keybindings.js +156 -99
- package/dist/keybindings.js.map +1 -1
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +14 -3
- package/dist/tui.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getKeybindings } from "../keybindings.js";
|
|
2
2
|
import { decodeKittyPrintable, matchesKey } from "../keys.js";
|
|
3
3
|
import { KillRing } from "../kill-ring.js";
|
|
4
4
|
import { CURSOR_MARKER } from "../tui.js";
|
|
@@ -414,11 +414,11 @@ export class Editor {
|
|
|
414
414
|
return result;
|
|
415
415
|
}
|
|
416
416
|
handleInput(data) {
|
|
417
|
-
const kb =
|
|
417
|
+
const kb = getKeybindings();
|
|
418
418
|
// Handle character jump mode (awaiting next character to jump to)
|
|
419
419
|
if (this.jumpMode !== null) {
|
|
420
420
|
// Cancel if the hotkey is pressed again
|
|
421
|
-
if (kb.matches(data, "jumpForward") || kb.matches(data, "jumpBackward")) {
|
|
421
|
+
if (kb.matches(data, "tui.editor.jumpForward") || kb.matches(data, "tui.editor.jumpBackward")) {
|
|
422
422
|
this.jumpMode = null;
|
|
423
423
|
return;
|
|
424
424
|
}
|
|
@@ -457,25 +457,25 @@ export class Editor {
|
|
|
457
457
|
return;
|
|
458
458
|
}
|
|
459
459
|
// Ctrl+C - let parent handle (exit/clear)
|
|
460
|
-
if (kb.matches(data, "copy")) {
|
|
460
|
+
if (kb.matches(data, "tui.input.copy")) {
|
|
461
461
|
return;
|
|
462
462
|
}
|
|
463
463
|
// Undo
|
|
464
|
-
if (kb.matches(data, "undo")) {
|
|
464
|
+
if (kb.matches(data, "tui.editor.undo")) {
|
|
465
465
|
this.undo();
|
|
466
466
|
return;
|
|
467
467
|
}
|
|
468
468
|
// Handle autocomplete mode
|
|
469
469
|
if (this.autocompleteState && this.autocompleteList) {
|
|
470
|
-
if (kb.matches(data, "
|
|
470
|
+
if (kb.matches(data, "tui.select.cancel")) {
|
|
471
471
|
this.cancelAutocomplete();
|
|
472
472
|
return;
|
|
473
473
|
}
|
|
474
|
-
if (kb.matches(data, "
|
|
474
|
+
if (kb.matches(data, "tui.select.up") || kb.matches(data, "tui.select.down")) {
|
|
475
475
|
this.autocompleteList.handleInput(data);
|
|
476
476
|
return;
|
|
477
477
|
}
|
|
478
|
-
if (kb.matches(data, "tab")) {
|
|
478
|
+
if (kb.matches(data, "tui.input.tab")) {
|
|
479
479
|
const selected = this.autocompleteList.getSelectedItem();
|
|
480
480
|
if (selected && this.autocompleteProvider) {
|
|
481
481
|
const shouldChainSlashArgumentAutocomplete = this.shouldChainSlashArgumentAutocompleteOnTabSelection();
|
|
@@ -494,7 +494,7 @@ export class Editor {
|
|
|
494
494
|
}
|
|
495
495
|
return;
|
|
496
496
|
}
|
|
497
|
-
if (kb.matches(data, "
|
|
497
|
+
if (kb.matches(data, "tui.select.confirm")) {
|
|
498
498
|
const selected = this.autocompleteList.getSelectedItem();
|
|
499
499
|
if (selected && this.autocompleteProvider) {
|
|
500
500
|
this.pushUndoSnapshot();
|
|
@@ -517,63 +517,63 @@ export class Editor {
|
|
|
517
517
|
}
|
|
518
518
|
}
|
|
519
519
|
// Tab - trigger completion
|
|
520
|
-
if (kb.matches(data, "tab") && !this.autocompleteState) {
|
|
520
|
+
if (kb.matches(data, "tui.input.tab") && !this.autocompleteState) {
|
|
521
521
|
this.handleTabCompletion();
|
|
522
522
|
return;
|
|
523
523
|
}
|
|
524
524
|
// Deletion actions
|
|
525
|
-
if (kb.matches(data, "deleteToLineEnd")) {
|
|
525
|
+
if (kb.matches(data, "tui.editor.deleteToLineEnd")) {
|
|
526
526
|
this.deleteToEndOfLine();
|
|
527
527
|
return;
|
|
528
528
|
}
|
|
529
|
-
if (kb.matches(data, "deleteToLineStart")) {
|
|
529
|
+
if (kb.matches(data, "tui.editor.deleteToLineStart")) {
|
|
530
530
|
this.deleteToStartOfLine();
|
|
531
531
|
return;
|
|
532
532
|
}
|
|
533
|
-
if (kb.matches(data, "deleteWordBackward")) {
|
|
533
|
+
if (kb.matches(data, "tui.editor.deleteWordBackward")) {
|
|
534
534
|
this.deleteWordBackwards();
|
|
535
535
|
return;
|
|
536
536
|
}
|
|
537
|
-
if (kb.matches(data, "deleteWordForward")) {
|
|
537
|
+
if (kb.matches(data, "tui.editor.deleteWordForward")) {
|
|
538
538
|
this.deleteWordForward();
|
|
539
539
|
return;
|
|
540
540
|
}
|
|
541
|
-
if (kb.matches(data, "deleteCharBackward") || matchesKey(data, "shift+backspace")) {
|
|
541
|
+
if (kb.matches(data, "tui.editor.deleteCharBackward") || matchesKey(data, "shift+backspace")) {
|
|
542
542
|
this.handleBackspace();
|
|
543
543
|
return;
|
|
544
544
|
}
|
|
545
|
-
if (kb.matches(data, "deleteCharForward") || matchesKey(data, "shift+delete")) {
|
|
545
|
+
if (kb.matches(data, "tui.editor.deleteCharForward") || matchesKey(data, "shift+delete")) {
|
|
546
546
|
this.handleForwardDelete();
|
|
547
547
|
return;
|
|
548
548
|
}
|
|
549
549
|
// Kill ring actions
|
|
550
|
-
if (kb.matches(data, "yank")) {
|
|
550
|
+
if (kb.matches(data, "tui.editor.yank")) {
|
|
551
551
|
this.yank();
|
|
552
552
|
return;
|
|
553
553
|
}
|
|
554
|
-
if (kb.matches(data, "yankPop")) {
|
|
554
|
+
if (kb.matches(data, "tui.editor.yankPop")) {
|
|
555
555
|
this.yankPop();
|
|
556
556
|
return;
|
|
557
557
|
}
|
|
558
558
|
// Cursor movement actions
|
|
559
|
-
if (kb.matches(data, "cursorLineStart")) {
|
|
559
|
+
if (kb.matches(data, "tui.editor.cursorLineStart")) {
|
|
560
560
|
this.moveToLineStart();
|
|
561
561
|
return;
|
|
562
562
|
}
|
|
563
|
-
if (kb.matches(data, "cursorLineEnd")) {
|
|
563
|
+
if (kb.matches(data, "tui.editor.cursorLineEnd")) {
|
|
564
564
|
this.moveToLineEnd();
|
|
565
565
|
return;
|
|
566
566
|
}
|
|
567
|
-
if (kb.matches(data, "cursorWordLeft")) {
|
|
567
|
+
if (kb.matches(data, "tui.editor.cursorWordLeft")) {
|
|
568
568
|
this.moveWordBackwards();
|
|
569
569
|
return;
|
|
570
570
|
}
|
|
571
|
-
if (kb.matches(data, "cursorWordRight")) {
|
|
571
|
+
if (kb.matches(data, "tui.editor.cursorWordRight")) {
|
|
572
572
|
this.moveWordForwards();
|
|
573
573
|
return;
|
|
574
574
|
}
|
|
575
575
|
// New line
|
|
576
|
-
if (kb.matches(data, "newLine") ||
|
|
576
|
+
if (kb.matches(data, "tui.input.newLine") ||
|
|
577
577
|
(data.charCodeAt(0) === 10 && data.length > 1) ||
|
|
578
578
|
data === "\x1b\r" ||
|
|
579
579
|
data === "\x1b[13;2~" ||
|
|
@@ -588,7 +588,7 @@ export class Editor {
|
|
|
588
588
|
return;
|
|
589
589
|
}
|
|
590
590
|
// Submit (Enter)
|
|
591
|
-
if (kb.matches(data, "submit")) {
|
|
591
|
+
if (kb.matches(data, "tui.input.submit")) {
|
|
592
592
|
if (this.disableSubmit)
|
|
593
593
|
return;
|
|
594
594
|
// Workaround for terminals without Shift+Enter support:
|
|
@@ -603,7 +603,7 @@ export class Editor {
|
|
|
603
603
|
return;
|
|
604
604
|
}
|
|
605
605
|
// Arrow key navigation (with history support)
|
|
606
|
-
if (kb.matches(data, "cursorUp")) {
|
|
606
|
+
if (kb.matches(data, "tui.editor.cursorUp")) {
|
|
607
607
|
if (this.isEditorEmpty()) {
|
|
608
608
|
this.navigateHistory(-1);
|
|
609
609
|
}
|
|
@@ -619,7 +619,7 @@ export class Editor {
|
|
|
619
619
|
}
|
|
620
620
|
return;
|
|
621
621
|
}
|
|
622
|
-
if (kb.matches(data, "cursorDown")) {
|
|
622
|
+
if (kb.matches(data, "tui.editor.cursorDown")) {
|
|
623
623
|
if (this.historyIndex > -1 && this.isOnLastVisualLine()) {
|
|
624
624
|
this.navigateHistory(1);
|
|
625
625
|
}
|
|
@@ -632,29 +632,29 @@ export class Editor {
|
|
|
632
632
|
}
|
|
633
633
|
return;
|
|
634
634
|
}
|
|
635
|
-
if (kb.matches(data, "cursorRight")) {
|
|
635
|
+
if (kb.matches(data, "tui.editor.cursorRight")) {
|
|
636
636
|
this.moveCursor(0, 1);
|
|
637
637
|
return;
|
|
638
638
|
}
|
|
639
|
-
if (kb.matches(data, "cursorLeft")) {
|
|
639
|
+
if (kb.matches(data, "tui.editor.cursorLeft")) {
|
|
640
640
|
this.moveCursor(0, -1);
|
|
641
641
|
return;
|
|
642
642
|
}
|
|
643
643
|
// Page up/down - scroll by page and move cursor
|
|
644
|
-
if (kb.matches(data, "pageUp")) {
|
|
644
|
+
if (kb.matches(data, "tui.editor.pageUp")) {
|
|
645
645
|
this.pageScroll(-1);
|
|
646
646
|
return;
|
|
647
647
|
}
|
|
648
|
-
if (kb.matches(data, "pageDown")) {
|
|
648
|
+
if (kb.matches(data, "tui.editor.pageDown")) {
|
|
649
649
|
this.pageScroll(1);
|
|
650
650
|
return;
|
|
651
651
|
}
|
|
652
652
|
// Character jump mode triggers
|
|
653
|
-
if (kb.matches(data, "jumpForward")) {
|
|
653
|
+
if (kb.matches(data, "tui.editor.jumpForward")) {
|
|
654
654
|
this.jumpMode = "forward";
|
|
655
655
|
return;
|
|
656
656
|
}
|
|
657
|
-
if (kb.matches(data, "jumpBackward")) {
|
|
657
|
+
if (kb.matches(data, "tui.editor.jumpBackward")) {
|
|
658
658
|
this.jumpMode = "backward";
|
|
659
659
|
return;
|
|
660
660
|
}
|
|
@@ -973,7 +973,7 @@ export class Editor {
|
|
|
973
973
|
return false;
|
|
974
974
|
if (!matchesKey(data, "enter"))
|
|
975
975
|
return false;
|
|
976
|
-
const submitKeys = kb.getKeys("submit");
|
|
976
|
+
const submitKeys = kb.getKeys("tui.input.submit");
|
|
977
977
|
const hasShiftEnter = submitKeys.includes("shift+enter") || submitKeys.includes("shift+return");
|
|
978
978
|
if (!hasShiftEnter)
|
|
979
979
|
return false;
|