Skip to content

Commit 8390910

Browse files
committed
WIP
1 parent 9f3384e commit 8390910

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

plugins/viewer/textviewer/src/clightningfastviewer.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)