Skip to content

Fix StringIndexOutOfBoundsException for Rich Text Editor#638

Open
rguzman1-godaddy wants to merge 1 commit intoMohamedRejeb:mainfrom
rguzman1-godaddy:fix/nested-indentation-crash
Open

Fix StringIndexOutOfBoundsException for Rich Text Editor#638
rguzman1-godaddy wants to merge 1 commit intoMohamedRejeb:mainfrom
rguzman1-godaddy:fix/nested-indentation-crash

Conversation

@rguzman1-godaddy
Copy link

@rguzman1-godaddy rguzman1-godaddy commented Feb 6, 2026

📃 Description

The bug is in correctMarkdownText() function in MarkdownUtils.kt. The function modifies the input text but produces shorter output than expected, causing AST offset mismatches.

The Problem Flow

  1. Original text is passed to markdown parser → AST built with offsets based on original length
  2. correctMarkdownText() processes text → output is SHORTER than input (spaces lost)
  3. getTextInNode() uses AST offsets on corrected text → CRASH (offset exceeds length)

Before

Screenshot 2026-02-05 at 23 46 28 Screenshot 2026-02-05 at 23 46 04

After

Screenshot 2026-02-06 at 00 16 46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant