Commit 60c393a
fix(search): deduplicate and merge overlapping match indices
When a search pattern exceeds MAX_BITS (32 chars), it is split into
chunks. Each chunk produces its own match indices, which were
concatenated without deduplication, resulting in duplicate and
overlapping index ranges. This broke highlighting implementations.
Now indices from multiple chunks are sorted and merged into
non-overlapping ranges before being returned.
Closes #735
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 58c7c73 commit 60c393a
14 files changed
Lines changed: 157 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
800 | 800 | | |
801 | 801 | | |
802 | 802 | | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
803 | 820 | | |
804 | 821 | | |
805 | 822 | | |
| |||
927 | 944 | | |
928 | 945 | | |
929 | 946 | | |
930 | | - | |
| 947 | + | |
931 | 948 | | |
932 | 949 | | |
933 | 950 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
804 | 804 | | |
805 | 805 | | |
806 | 806 | | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
807 | 824 | | |
808 | 825 | | |
809 | 826 | | |
| |||
931 | 948 | | |
932 | 949 | | |
933 | 950 | | |
934 | | - | |
| 951 | + | |
935 | 952 | | |
936 | 953 | | |
937 | 954 | | |
| |||
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
715 | 715 | | |
716 | 716 | | |
717 | 717 | | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
718 | 738 | | |
719 | 739 | | |
720 | 740 | | |
| |||
843 | 863 | | |
844 | 864 | | |
845 | 865 | | |
846 | | - | |
| 866 | + | |
847 | 867 | | |
848 | 868 | | |
849 | 869 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
867 | 867 | | |
868 | 868 | | |
869 | 869 | | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
870 | 887 | | |
871 | 888 | | |
872 | 889 | | |
| |||
994 | 1011 | | |
995 | 1012 | | |
996 | 1013 | | |
997 | | - | |
| 1014 | + | |
998 | 1015 | | |
999 | 1016 | | |
1000 | 1017 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
871 | 871 | | |
872 | 872 | | |
873 | 873 | | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
874 | 891 | | |
875 | 892 | | |
876 | 893 | | |
| |||
998 | 1015 | | |
999 | 1016 | | |
1000 | 1017 | | |
1001 | | - | |
| 1018 | + | |
1002 | 1019 | | |
1003 | 1020 | | |
1004 | 1021 | | |
| |||
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments