File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed
lib/src/default_editor/text_tokenizing
test/super_editor/text_entry/tagging Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -316,7 +316,7 @@ class ActionTagComposingReaction extends EditReaction {
316316 tagRule: _tagRule,
317317 nodeId: textNode.id,
318318 text: textNode.text,
319- expansionPosition: base .nodePosition as TextNodePosition ,
319+ expansionPosition: extent .nodePosition as TextNodePosition ,
320320 isTokenCandidate: (attributions) => ! attributions.contains (actionTagCancelledAttribution),
321321 );
322322 }
Original file line number Diff line number Diff line change @@ -633,6 +633,38 @@ void main() {
633633 });
634634 });
635635 });
636+
637+ group ("selections >" , () {
638+ testWidgetsOnAllPlatforms ("can find tag that surrounds the extent position when the selection is expanded" ,
639+ (tester) async {
640+ await _pumpTestEditor (
641+ tester,
642+ paragraphThenHrDoc (),
643+ );
644+
645+ // Create cancelled action tag
646+ await tester.placeCaretInParagraph ("1" , 0 );
647+ await tester.typeImeText ("/header " );
648+
649+ // Place cursor at the end of the horizontal rule/block node
650+ await tester.pressDownArrow ();
651+ await tester.pressRightArrow ();
652+
653+ // Select upstream towards the cancelled action tag
654+ await expectLater (
655+ () async {
656+ await tester.pressShiftLeftArrow ();
657+ await tester.pressShiftUpArrow ();
658+ },
659+ returnsNormally,
660+ );
661+
662+ // If we reach the end without exception, then ActionTagComposingReaction did not blow up due to the base or extent
663+ // position, and type of content at those positions.
664+ //
665+ // Original bug: https://github.com/superlistapp/super_editor/pull/2201
666+ });
667+ });
636668}
637669
638670Future <TestDocumentContext > _pumpTestEditor (
You can’t perform that action at this time.
0 commit comments