Skip to content

Commit 94658e2

Browse files
committed
fix(ios): update onText to handle out-of-buffer tokens and clarify newline handling
1 parent 5dfd2a3 commit 94658e2

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

ios/input/ENRMInputParser.mm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ static int onText(MD_TEXTTYPE, const MD_CHAR *text, MD_SIZE size, void *userdata
188188
// md4c passes pointers outside the input buffer for synthetic tokens
189189
// (e.g. MD_TEXT_SOFTBR, MD_TEXT_BR use a string literal "\n").
190190
// Pointer arithmetic against context->buffer would underflow, corrupting offsets.
191+
//
192+
// TODO: Skipping out-of-buffer tokens means lastTextEnd doesn't advance past
193+
// newlines. Fine for inline spans, but if block-level input formatting is
194+
// added later, openingDelimiterByteOffset will include newline chars in the
195+
// syntax range. See the related TODO above onEnterBlock.
191196
bool insideBuffer = (text >= context->buffer && text < context->buffer + context->bufferLength);
192197
if (!insideBuffer) {
193198
return 0;

0 commit comments

Comments
 (0)