@@ -175,4 +175,55 @@ describe('mixedBidiBackspace (chain command)', () => {
175175 expect ( __TEST_ONLY__ . hasMixedDirectionBoundary ( 'A' , 'B' ) ) . toBe ( false ) ;
176176 expect ( __TEST_ONLY__ . hasMixedDirectionBoundary ( 'א' , 'ש' ) ) . toBe ( false ) ;
177177 } ) ;
178+
179+ // SD-3169: Hebrew/Arabic presentation forms (legacy ligature codepoints used
180+ // by older fonts and some legacy systems) live outside the Hebrew/Arabic
181+ // core blocks. The Phase 6 STRONG_RTL_CHAR_RE = /[\u0590-\u08FF]/ missed
182+ // them, so a paragraph mixing presentation-form Hebrew/Arabic with Latin
183+ // would not have its boundary detected and mixed-bidi Backspace would not
184+ // fire. Pin via the helper and the end-to-end command path.
185+ describe ( 'SD-3169 Hebrew/Arabic presentation forms' , ( ) => {
186+ it ( 'hasMixedDirectionBoundary recognizes Hebrew presentation forms (FB1D-FB4F)' , ( ) => {
187+ // \uFB21 = Hebrew Letter Wide Alef. Boundary against Latin must register.
188+ expect ( __TEST_ONLY__ . hasMixedDirectionBoundary ( '\uFB21' , 'A' ) ) . toBe ( true ) ;
189+ expect ( __TEST_ONLY__ . hasMixedDirectionBoundary ( 'A' , '\uFB21' ) ) . toBe ( true ) ;
190+ // \uFB4F = Hebrew Ligature Alef Lamed (last code point in the range).
191+ expect ( __TEST_ONLY__ . hasMixedDirectionBoundary ( '\uFB4F' , 'B' ) ) . toBe ( true ) ;
192+ } ) ;
193+
194+ it ( 'hasMixedDirectionBoundary recognizes Arabic Presentation Forms-A (FB50-FDFF)' , ( ) => {
195+ // \uFB50 = Arabic Letter Alef Wasla Isolated Form (first code point).
196+ expect ( __TEST_ONLY__ . hasMixedDirectionBoundary ( '\uFB50' , 'A' ) ) . toBe ( true ) ;
197+ // \uFDF2 = Arabic Ligature Allah Isolated Form.
198+ expect ( __TEST_ONLY__ . hasMixedDirectionBoundary ( '\uFDF2' , 'A' ) ) . toBe ( true ) ;
199+ } ) ;
200+
201+ it ( 'hasMixedDirectionBoundary recognizes Arabic Presentation Forms-B (FE70-FEFF)' , ( ) => {
202+ // \uFE70 = Arabic Fathatan Isolated Form (first code point).
203+ expect ( __TEST_ONLY__ . hasMixedDirectionBoundary ( '\uFE70' , 'A' ) ) . toBe ( true ) ;
204+ // \uFEFC = Arabic Ligature Lam With Alef Final Form (last letter form).
205+ expect ( __TEST_ONLY__ . hasMixedDirectionBoundary ( '\uFEFC' , 'A' ) ) . toBe ( true ) ;
206+ } ) ;
207+
208+ it ( 'hasMixedDirectionBoundary excludes noncharacters in the Arabic A range' , ( ) => {
209+ // FDD0-FDEF are Unicode noncharacters, not strong-RTL.
210+ // FEFF is ZERO WIDTH NO-BREAK SPACE (BOM), not strong-RTL.
211+ expect ( __TEST_ONLY__ . hasMixedDirectionBoundary ( '\uFDD0' , 'A' ) ) . toBe ( false ) ;
212+ expect ( __TEST_ONLY__ . hasMixedDirectionBoundary ( '\uFEFF' , 'A' ) ) . toBe ( false ) ;
213+ } ) ;
214+
215+ it ( 'returns true and mutates tr on presentation-form-Hebrew + Latin boundary' , ( ) => {
216+ const { state, view, tr } = setupContext ( {
217+ text : '\uFB21A' ,
218+ charLefts : [ 10 , 20 ] ,
219+ caretRect : makeRect ( 20 , 10 , 1 , 12 ) ,
220+ selectionFrom : 11 ,
221+ pmBase : 10 ,
222+ } ) ;
223+
224+ const handled = mixedBidiBackspace ( ) ( { state, view, tr, dispatch : vi . fn ( ) } ) ;
225+ expect ( handled ) . toBe ( true ) ;
226+ expect ( tr . delete ) . toHaveBeenCalledWith ( 10 , 11 ) ;
227+ } ) ;
228+ } ) ;
178229} ) ;
0 commit comments