Commit 6e55ecc
committed
fix(render): Fold like rustc
Before, we elided all small sets of unhighlighted lines and then
partially elided large sets of unhighlighted lines (favoring the start).
In contrast, rustc shows 2 lines of context, split between the start and
end of the fold.
If there are 3 unhighlighted lines, it just skips folding.
This makes a lot more sense.
See https://github.com/rust-lang/rust/blob/2627e9f3012a97d3136b3e11bf6bd0853c38a534/compiler/rustc_errors/src/emitter.rs#L1878C17-L1939C18
In contrast to rustc, I made the amount of context a variable to make
the intent clearer and to open the door to it being configurable.1 parent 65b6bef commit 6e55ecc
File tree
3 files changed
+59
-103
lines changed- examples
- src/renderer
- tests/fixtures/no-color
3 files changed
+59
-103
lines changedLoading
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
919 | 919 | | |
920 | 920 | | |
921 | 921 | | |
922 | | - | |
923 | | - | |
924 | | - | |
925 | | - | |
926 | | - | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
927 | 925 | | |
928 | 926 | | |
929 | | - | |
930 | | - | |
931 | | - | |
932 | | - | |
933 | | - | |
934 | | - | |
935 | | - | |
936 | | - | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
937 | 931 | | |
938 | | - | |
939 | | - | |
| 932 | + | |
940 | 933 | | |
941 | | - | |
942 | | - | |
943 | | - | |
944 | | - | |
945 | | - | |
946 | | - | |
947 | | - | |
948 | | - | |
949 | | - | |
950 | | - | |
951 | | - | |
952 | | - | |
953 | | - | |
954 | | - | |
955 | | - | |
956 | | - | |
957 | | - | |
958 | | - | |
959 | | - | |
960 | | - | |
961 | | - | |
962 | | - | |
963 | | - | |
964 | | - | |
965 | | - | |
966 | | - | |
967 | | - | |
968 | | - | |
969 | | - | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
970 | 943 | | |
971 | | - | |
972 | | - | |
973 | | - | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
974 | 969 | | |
975 | 970 | | |
976 | | - | |
| 971 | + | |
977 | 972 | | |
978 | 973 | | |
979 | | - | |
980 | | - | |
981 | | - | |
982 | | - | |
983 | 974 | | |
984 | | - | |
985 | | - | |
986 | | - | |
987 | | - | |
988 | | - | |
989 | | - | |
990 | | - | |
991 | | - | |
992 | | - | |
993 | | - | |
994 | | - | |
995 | | - | |
996 | | - | |
997 | | - | |
998 | | - | |
999 | | - | |
1000 | | - | |
1001 | | - | |
1002 | | - | |
1003 | | - | |
1004 | | - | |
1005 | | - | |
1006 | | - | |
1007 | | - | |
1008 | | - | |
1009 | | - | |
1010 | | - | |
1011 | | - | |
1012 | | - | |
1013 | | - | |
1014 | | - | |
1015 | | - | |
| 975 | + | |
1016 | 976 | | |
1017 | 977 | | |
1018 | 978 | | |
1019 | 979 | | |
1020 | | - | |
| 980 | + | |
1021 | 981 | | |
1022 | 982 | | |
1023 | 983 | | |
| |||
Loading
0 commit comments