FS#2789Text editor: avoid linebreak in stacked text
- Type
- Bug
- Status
- Closed
- Resolution
- Fixed
- Category
- QCAD (main)
- Severity
- Low
- Priority
- Low
- Reported version
- 27.0.6
- Operating system
- All
- Reported
- 2026-11-17 by andrew
- Forum
- Discussion
Problem
When a line in the text dialog ended with superscript or subscript text, the line feed was written inside the stacked text sequence. The resulting markup is not valid CAD (DXF/DWG) text markup.
Example: "A" followed by superscript "2", then Enter, then "B":
- Actual: A\S2\P^;B
- Expected: A\S2^;\PB
In the rich text editor, pressing Enter at the end of a superscript or subscript also kept that mode active on the new line, so the next line unintentionally started as superscript / subscript.
Steps to reproduce
- Draw > Text, type A.
- Switch on Superscript, type 2.
- Press Enter, type B.
- Switch to the source tab: \P is inside the \S…; sequence, and "B" is superscript.
Fix
- Markup conversion (RTextBasedData::toEscapedText in src/core/RTextBasedData.cpp): a stacked text sequence is now always closed before a line feed, for both paragraph breaks (Enter) and line breaks (Shift+Enter). If the superscript / subscript continues on the next line, a new sequence is opened there.
- Rich text editor (scripts/Draw/Text/TextDialog/TextDialog.js): superscript / subscript is switched off automatically when the cursor lands on a new, empty line, so it no longer wraps around lines.