mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-01-03 12:02:36 +00:00
In particular when configured to replace several ranges with multiple fonts. Given the following `font-codepoint-map` config: ``` font-codepoint-map=U+0030-U+0039=Monaco # 0-9 font-codepoint-map=U+0040=mononoki # @ font-codepoint-map=U+0041-U+005a=Pixel Code # A-Z font-codepoint-map=U+0061-U+007a=Victor Mono # a-z ``` I noticed a couple of unexpected behavior: 1. Codepoint ranges were assigned the wrong font 2. The declaration order had a direct impact on the font assignment (seemed to be rotating in some fashion) If my understanding of the current implementation is correct, for a given range index `n` in the `MultiArrayList` `CodepointMap.get(…)` returns the font descriptor at index `len - n - 1`. In other words, it returns the descriptor symmetrically opposite relative to the middle of the list. I've added a couple test cases that I would expect to pass if my understanding of the expected behavior is correct, verified that they were broken under the current behavior, and updated the implementation of `CodepointMap.get(…)` accordingly. My understanding of the original intent is to give priority to the latest range match in the list (which is a use case already tested by the `codepointmap` test, but which I believe happened to pass "by accident"), so I opted for a reverse traversal of the codepoint list.