Repository navigation
fix: complete global source maps and Arabic ligature spans - #14
Conversation
|
בבדיקת הביצועים של תיקון מיפויי המקור נמצא ש־finishLamAlef מסיר את ה־alef מכל שלושת מערכי המיפוי באמצעות removeAt, ולכן קלט צפוף בליגטורות נעשה ריבועי. הכנתי תיקון המשך המבוסס ישירות על head הנוכחי של PR זה. הוא דוחס את המיפויים והאורכים במעבר קדימה ומקצר את המערכים פעם אחת, תוך שימור מיפוי וטווחי ניקוד שקוף. נוספו בדיקת צפיפות ובנצ׳מרק שחזור. כל 15 בדיקות הענף ו־dart analyze עברו. השוואת 10,000 מחרוזות אקראיות קבועות בשילוב הפורק אימתה זהות של פלט, אינדקסים, טווחי מקור ואורכי נרמול. מדידת AOT מקומית של 10,000 ליגטורות בשילוב ירדה מכ־690 מ״ש לכ־7 מ״ש; זו מדידה סינתטית ולא זמן הדפסה כולל. לא הייתה הרשאת כתיבה זמינה לענף המקורי ב־palmoni5/bidi, ולכן התיקון פורסם ב־ענף הארגון לצורך יישום באותו PR. הענף עצמאי מ־#13, הענף המקורי לא שונה ולא נפתח PR כפול. |
Problem and resulting behavior
logicalToVisual2omitted paragraph-separator mappings, restarted source indices in each paragraph and left itslengthsoutput empty. Forabc\nאבג, upstream main returned indices[0, 1, 2, 2, 1, 0]and no spans; this branch returns[0, 1, 2, 3, 6, 5, 4]with seven spans of length one. Existing caller entries remain intact and new mappings are appended.Expose aligned per-paragraph
sourceLengthsand return global UTF-16 source offsets and spans, including separators. Preserve consumed source spans during Arabic lam-alef shaping and close the ligature state so a following alef remains visible. Forل\u064EاX, the old source index ofXwas 2; it is now correctly 3.Transparent marks require explicit source indices: a lam-alef glyph spans the entire logical interval from lam through alef, including intervening transparent marks, while those still-visible marks retain their own source indices and one-unit spans. These source intervals intentionally overlap. For
ل\u064EاX, the ligature maps to offset 0/span 3, the mark to offset 1/span 1, andXto offset 3/span 1.Normalization.lengthsseparately accounts for consumed logical source units and preserves its total source length.Validation
ebef4fb), then confirmed corrected results with this branch.flutter analyze: no issues.dart test: all 14 tests pass, covering multiple separators, formatting controls, canonical composition, caller-owned list append behavior, ordinary Arabic, all four alef variants, joined and isolated ligatures, a second alef, and one or multiple transparent marks with overlapping source spans.This PR is independently based on upstream main and groups the public visual-to-source mapping contract with the Arabic shaping bookkeeping required to make it correct. Performance, supplementary scalar handling, combining-mark reordering and bracket resolution are submitted separately. No package-version change.