File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
plugins/viewer/textviewer/src Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -740,16 +740,16 @@ void CLightningFastViewerWidget::wrapText()
740740 {
741741 // No wrapping - split on newlines only
742742 int start = 0 ;
743- for (int i = 0 ; i < _text.length (); ++i)
743+ int newlinePos;
744+
745+ while ((newlinePos = _text.indexOf (' \n ' , start)) != -1 )
744746 {
745- if (_text[i] == ' \n ' )
746- {
747- _lineOffsets.push_back (start);
748- _lineLengths.push_back (i - start + 1 ); // Include the newline
749- start = i + 1 ;
750- }
747+ _lineOffsets.push_back (start);
748+ _lineLengths.push_back (newlinePos - start + 1 ); // Include the newline
749+ start = newlinePos + 1 ;
751750 }
752- // Last line
751+
752+ // Last line (or entire text if no newlines)
753753 if (start < _text.length ())
754754 {
755755 _lineOffsets.push_back (start);
You can’t perform that action at this time.
0 commit comments