@@ -600,3 +600,314 @@ tests: |
| 600 | 600 | - send_line: "echo hi" |
| 601 | 601 | expect_output: "hi" |
| 602 | 602 | match_type: "contains" |
| 603 | + |
| 604 | + # ============================================================= |
| 605 | + # SPRINT 7 — EXPANDED COVERAGE |
| 606 | + # UTF-8 safety, explicit collapse-on-motion for every movement |
| 607 | + # type, Shift+Up/Down, and edge cases across all categories. |
| 608 | + # ============================================================= |
| 609 | + |
| 610 | + # ---------- UTF-8 safety (pattern #11) ---------- |
| 611 | + |
| 612 | + - name: "Sprint 7 UTF-8: Shift+Left over emoji selects one full codepoint" |
| 613 | + # Emoji 🎉 is U+1F389, encoded as 4 UTF-8 bytes (F0 9F 8E 89). |
| 614 | + # Shift+Left from end of "ab🎉" should move cursor back 4 bytes, |
| 615 | + # selecting just the emoji (not half of it). Type 'Z' → "abZ". |
| 616 | + # If byte-safe stepping broke, we'd corrupt the codepoint. |
| 617 | + steps: |
| 618 | + - send: "ab🎉" |
| 619 | + - send_key: "S-Left" |
| 620 | + - send: "Z" |
| 621 | + - send_key: "C-a" |
| 622 | + - send: "echo " |
| 623 | + - send_key: "Enter" |
| 624 | + expect_output: "abZ" |
| 625 | + match_type: "contains" |
| 626 | + |
| 627 | + - name: "Sprint 7 UTF-8: Backspace over selected emoji removes 4 bytes" |
| 628 | + steps: |
| 629 | + - send: "ab🎉cd" |
| 630 | + - send_key: "Left" |
| 631 | + - send_key: "Left" |
| 632 | + - send_key: "S-Left" |
| 633 | + - send_key: "Backspace" |
| 634 | + - send_key: "C-a" |
| 635 | + - send: "echo " |
| 636 | + - send_key: "Enter" |
| 637 | + expect_output: "abcd" |
| 638 | + match_type: "contains" |
| 639 | + |
| 640 | + - name: "Sprint 7 UTF-8: Ctrl+W cuts selection containing multi-byte chars" |
| 641 | + # Accented 'é' is 2 bytes (C3 A9). Select "éé" with Shift+Left x2, |
| 642 | + # cut with Ctrl+W. Buffer left with "ab". |
| 643 | + steps: |
| 644 | + - send: "abéé" |
| 645 | + - send_key: "S-Left" |
| 646 | + - send_key: "S-Left" |
| 647 | + - send_key: "C-w" |
| 648 | + - send_key: "C-a" |
| 649 | + - send: "echo " |
| 650 | + - send_key: "Enter" |
| 651 | + expect_output: "ab" |
| 652 | + match_type: "contains" |
| 653 | + |
| 654 | + - name: "Sprint 7 UTF-8: type-over multi-byte selection inserts ASCII cleanly" |
| 655 | + steps: |
| 656 | + - send: "héllo" |
| 657 | + - send_key: "S-Home" |
| 658 | + - send: "X" |
| 659 | + - send_key: "C-a" |
| 660 | + - send: "echo " |
| 661 | + - send_key: "Enter" |
| 662 | + expect_output: "X" |
| 663 | + match_type: "contains" |
| 664 | + |
| 665 | + # ---------- Collapse-on-motion for every movement type ---------- |
| 666 | + |
| 667 | + - name: "Sprint 7 collapse: plain Home with selection clears, goes to 0" |
| 668 | + steps: |
| 669 | + - send: "abcd" |
| 670 | + - send_key: "S-Left" |
| 671 | + - send_key: "S-Left" |
| 672 | + - send_key: "Home" |
| 673 | + - send: "Z" |
| 674 | + - send_key: "C-e" |
| 675 | + - send: " x" |
| 676 | + - send_key: "C-a" |
| 677 | + - send: "echo " |
| 678 | + - send_key: "Enter" |
| 679 | + # Selection=[2..4). Plain Home clears, cursor=0. Z at 0 → "Zabcd x". |
| 680 | + expect_output: "Zabcd x" |
| 681 | + match_type: "contains" |
| 682 | + |
| 683 | + - name: "Sprint 7 collapse: plain End with selection clears, goes to length" |
| 684 | + steps: |
| 685 | + - send: "abcd" |
| 686 | + - send_key: "C-a" |
| 687 | + - send_key: "S-Right" |
| 688 | + - send_key: "S-Right" |
| 689 | + - send_key: "End" |
| 690 | + - send: "Z" |
| 691 | + - send_key: "C-a" |
| 692 | + - send: "echo " |
| 693 | + - send_key: "Enter" |
| 694 | + # Selection=[0..2). Plain End clears, cursor=4. Z at 4 → "abcdZ". |
| 695 | + expect_output: "abcdZ" |
| 696 | + match_type: "contains" |
| 697 | + |
| 698 | + - name: "Sprint 7 collapse: plain Alt+f with selection clears, moves word fwd" |
| 699 | + steps: |
| 700 | + - send: "aaa bbb ccc" |
| 701 | + - send_key: "C-a" |
| 702 | + - send_key: "S-Right" # cursor=1, anchor=0 |
| 703 | + - send_key: "M-f" # clears selection, moves to end of "aaa" = 3 |
| 704 | + - send: "Z" # insert at 3 → "aaaZ bbb ccc" |
| 705 | + - send_key: "C-a" |
| 706 | + - send: "echo " |
| 707 | + - send_key: "Enter" |
| 708 | + expect_output: "aaaZ bbb ccc" |
| 709 | + match_type: "contains" |
| 710 | + |
| 711 | + - name: "Sprint 7 collapse: plain Alt+b with selection clears, moves word back" |
| 712 | + steps: |
| 713 | + - send: "aaa bbb" |
| 714 | + - send_key: "S-Left" # cursor=6, anchor=7 |
| 715 | + - send_key: "M-b" # clears, moves to start of word ("bbb" at 4) |
| 716 | + - send: "Z" # insert at 4 → "aaa Zbbb" |
| 717 | + - send_key: "C-a" |
| 718 | + - send: "echo " |
| 719 | + - send_key: "Enter" |
| 720 | + expect_output: "aaa Zbbb" |
| 721 | + match_type: "contains" |
| 722 | + |
| 723 | + # ---------- Shift+Up / Shift+Down (line-wise on single-line prompt) ---------- |
| 724 | + |
| 725 | + - name: "Sprint 7 line-wise: Shift+Up extends selection to line start" |
| 726 | + # Single-line prompt: Shift+Up = Shift+Home. Type "abcd", Shift+Up |
| 727 | + # anchors at 4, moves cursor to 0. Type 'Z' → buffer "Z" (selection |
| 728 | + # replaced by 'Z'). |
| 729 | + steps: |
| 730 | + - send: "abcd" |
| 731 | + - send_key: "S-Up" |
| 732 | + - send: "Z" |
| 733 | + - send_key: "C-a" |
| 734 | + - send: "echo " |
| 735 | + - send_key: "Enter" |
| 736 | + expect_output: "Z" |
| 737 | + match_type: "contains" |
| 738 | + |
| 739 | + - name: "Sprint 7 line-wise: Shift+Down extends selection to line end" |
| 740 | + # Shift+Down = Shift+End on single-line prompt. |
| 741 | + steps: |
| 742 | + - send: "abcd" |
| 743 | + - send_key: "C-a" |
| 744 | + - send_key: "S-Down" |
| 745 | + - send: "Z" |
| 746 | + - send_key: "C-a" |
| 747 | + - send: "echo " |
| 748 | + - send_key: "Enter" |
| 749 | + expect_output: "Z" |
| 750 | + match_type: "contains" |
| 751 | + |
| 752 | + # ---------- Word-wise extension variations ---------- |
| 753 | + |
| 754 | + - name: "Sprint 7 word: Ctrl+Shift+Left twice extends over two words" |
| 755 | + # "aaa bbb ccc" (cursor=11). C-S-Left → cursor=8, anchor=11. Again → |
| 756 | + # cursor=4, anchor=11. Selection spans "bbb ccc" [4..11). Backspace |
| 757 | + # deletes → "aaa ". Echo → "aaa". |
| 758 | + steps: |
| 759 | + - send: "aaa bbb ccc" |
| 760 | + - send_key: "C-S-Left" |
| 761 | + - send_key: "C-S-Left" |
| 762 | + - send_key: "Backspace" |
| 763 | + - send_key: "C-a" |
| 764 | + - send: "echo " |
| 765 | + - send_key: "Enter" |
| 766 | + expect_output: "aaa" |
| 767 | + match_type: "contains" |
| 768 | + |
| 769 | + - name: "Sprint 7 word: Alt+Shift+F twice extends over two words" |
| 770 | + # "aaa bbb ccc", C-a. M-F → cursor=3 (end of aaa). M-F → cursor=7 |
| 771 | + # (end of bbb). anchor=0, cursor=7. Selection="aaa bbb". Backspace |
| 772 | + # → " ccc". Leading space gets stripped by shell word-split. |
| 773 | + steps: |
| 774 | + - send: "aaa bbb ccc" |
| 775 | + - send_key: "C-a" |
| 776 | + - send_key: "M-F" |
| 777 | + - send_key: "M-F" |
| 778 | + - send_key: "Backspace" |
| 779 | + - send_key: "C-a" |
| 780 | + - send: "echo " |
| 781 | + - send_key: "Enter" |
| 782 | + expect_output: "ccc" |
| 783 | + match_type: "contains" |
| 784 | + |
| 785 | + - name: "Sprint 7 word: Ctrl+Shift+Right from mid-word jumps to word end" |
| 786 | + # "aaa bbb" (cursor=7). C-a (cursor=0). Right (cursor=1, mid-"aaa"). |
| 787 | + # C-S-Right → move_to_next_word from 1 lands at end of "aaa" = 3. |
| 788 | + # anchor=1, cursor=3. Plain Right snaps to max(1,3)=3. |
| 789 | + # Insert Z at 3 → "aaaZ bbb". |
| 790 | + steps: |
| 791 | + - send: "aaa bbb" |
| 792 | + - send_key: "C-a" |
| 793 | + - send_key: "Right" |
| 794 | + - send_key: "C-S-Right" |
| 795 | + - send_key: "Right" |
| 796 | + - send: "Z" |
| 797 | + - send_key: "C-a" |
| 798 | + - send: "echo " |
| 799 | + - send_key: "Enter" |
| 800 | + expect_output: "aaaZ bbb" |
| 801 | + match_type: "contains" |
| 802 | + |
| 803 | + # ---------- Cut / copy / paste edge cases ---------- |
| 804 | + |
| 805 | + - name: "Sprint 7 edge: cut then paste at different position" |
| 806 | + # Type "aaa bbb", select "bbb" (C-S-Left), Ctrl+W cuts, Ctrl+A to |
| 807 | + # start, Ctrl+Y pastes → "bbbaaa ". (Note: no space between bbb |
| 808 | + # and aaa since the original space was in "aaa bbb" not moved.) |
| 809 | + steps: |
| 810 | + - send: "aaa bbb" |
| 811 | + - send_key: "C-S-Left" |
| 812 | + - send_key: "C-w" |
| 813 | + - send_key: "C-a" |
| 814 | + - send_key: "C-y" |
| 815 | + - send_key: "C-e" |
| 816 | + - send_key: "C-a" |
| 817 | + - send: "echo " |
| 818 | + - send_key: "Enter" |
| 819 | + # Buffer trace: C-S-Left from 7 → 4, anchor=7, sel="bbb". |
| 820 | + # Ctrl+W → buffer "aaa ", cursor=4, kill_buffer="bbb". |
| 821 | + # C-a → cursor=0. C-y pastes "bbb" at 0 → "bbbaaa ", cursor=3. |
| 822 | + # C-e → cursor=7. C-a → cursor=0. echo + Enter → "bbbaaa". |
| 823 | + expect_output: "bbbaaa" |
| 824 | + match_type: "contains" |
| 825 | + |
| 826 | + - name: "Sprint 7 edge: Ctrl+Y at start of empty buffer pastes" |
| 827 | + steps: |
| 828 | + - send: "saved" |
| 829 | + - send_key: "C-u" # kills all into kill buffer |
| 830 | + - send_key: "C-y" # yanks back |
| 831 | + - send_key: "C-a" |
| 832 | + - send: "echo " |
| 833 | + - send_key: "Enter" |
| 834 | + expect_output: "saved" |
| 835 | + match_type: "contains" |
| 836 | + |
| 837 | + - name: "Sprint 7 edge: Ctrl+Y without kill buffer no-ops" |
| 838 | + # If kill_length == 0, Ctrl+Y returns without change. The buffer |
| 839 | + # here only has "hi", and Ctrl+Y should not corrupt it. |
| 840 | + steps: |
| 841 | + - send: "hi" |
| 842 | + - send_key: "C-y" |
| 843 | + - send_key: "C-a" |
| 844 | + - send: "echo " |
| 845 | + - send_key: "Enter" |
| 846 | + expect_output: "hi" |
| 847 | + match_type: "contains" |
| 848 | + |
| 849 | + # ---------- Backspace / Delete edge cases ---------- |
| 850 | + |
| 851 | + - name: "Sprint 7 edge: Backspace with selection at buffer start works" |
| 852 | + # Select "ab" from start, Backspace removes it → "cd". |
| 853 | + steps: |
| 854 | + - send: "abcd" |
| 855 | + - send_key: "C-a" |
| 856 | + - send_key: "S-Right" |
| 857 | + - send_key: "S-Right" |
| 858 | + - send_key: "Backspace" |
| 859 | + - send_key: "C-a" |
| 860 | + - send: "echo " |
| 861 | + - send_key: "Enter" |
| 862 | + expect_output: "cd" |
| 863 | + match_type: "contains" |
| 864 | + |
| 865 | + - name: "Sprint 7 edge: Delete with selection at buffer end works" |
| 866 | + # Select "cd" from end, Delete removes → "ab". |
| 867 | + steps: |
| 868 | + - send: "abcd" |
| 869 | + - send_key: "S-Left" |
| 870 | + - send_key: "S-Left" |
| 871 | + - send_key: "Delete" |
| 872 | + - send_key: "C-a" |
| 873 | + - send: "echo " |
| 874 | + - send_key: "Enter" |
| 875 | + expect_output: "ab" |
| 876 | + match_type: "contains" |
| 877 | + |
| 878 | + # ---------- Alt+W copy additional coverage ---------- |
| 879 | + |
| 880 | + - name: "Sprint 7 copy: Alt+W then immediately Ctrl+Y pastes duplicate" |
| 881 | + # Alt+W leaves selection un-deleted but collapses it. Ctrl+Y then |
| 882 | + # yanks the copied text at cursor → text is duplicated. |
| 883 | + steps: |
| 884 | + - send: "abcd" |
| 885 | + - send_key: "S-Home" # select "abcd", cursor=0, anchor=4 |
| 886 | + - send_key: "M-w" # copy + collapse (cursor stays at 0? or 4?) |
| 887 | + - send_key: "C-e" # move to end (should be 4) |
| 888 | + - send_key: "C-y" # paste "abcd" → "abcdabcd" |
| 889 | + - send_key: "C-a" |
| 890 | + - send: "echo " |
| 891 | + - send_key: "Enter" |
| 892 | + expect_output: "abcdabcd" |
| 893 | + match_type: "contains" |
| 894 | + |
| 895 | + # ---------- Abort selection paths ---------- |
| 896 | + |
| 897 | + - name: "Sprint 7 abort: Ctrl+G / Escape does not carry selection through" |
| 898 | + # Ctrl+G cancels search mode but doesn't directly touch selection. |
| 899 | + # However, after clearing, normal editing should show no snap. |
| 900 | + # Verify: select text, send a word motion WITHOUT shift — selection |
| 901 | + # clears and cursor moves. Then Backspace deletes ONE char (not |
| 902 | + # whole selection). |
| 903 | + steps: |
| 904 | + - send: "abcdef" |
| 905 | + - send_key: "S-Left" |
| 906 | + - send_key: "S-Left" # anchor=6, cursor=4 |
| 907 | + - send_key: "Left" # collapse to left edge (4), no motion |
| 908 | + - send_key: "Backspace" # delete ONE char (not selection) at 4 → "abcef" |
| 909 | + - send_key: "C-a" |
| 910 | + - send: "echo " |
| 911 | + - send_key: "Enter" |
| 912 | + expect_output: "abcef" |
| 913 | + match_type: "contains" |