mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 15:15:31 +00:00
Fix infinite recursion bug in uncommentSelection()
This commit is contained in:
parent
61e374fdfc
commit
1f699552f7
1 changed files with 10 additions and 7 deletions
|
@ -293,9 +293,9 @@ void CSVWorld::ScriptEdit::commentSelection()
|
|||
begin.movePosition(QTextCursor::StartOfLine);
|
||||
|
||||
end.setPosition(end.selectionEnd());
|
||||
end.movePosition(QTextCursor::StartOfLine);
|
||||
end.movePosition(QTextCursor::EndOfLine);
|
||||
|
||||
for (; begin <= end; begin.movePosition(QTextCursor::StartOfLine), begin.movePosition(QTextCursor::Down))
|
||||
for (; begin < end; begin.movePosition(QTextCursor::StartOfLine), begin.movePosition(QTextCursor::Down))
|
||||
{
|
||||
begin.insertText(";");
|
||||
}
|
||||
|
@ -309,13 +309,15 @@ void CSVWorld::ScriptEdit::uncommentSelection()
|
|||
begin.movePosition(QTextCursor::StartOfLine);
|
||||
|
||||
end.setPosition(end.selectionEnd());
|
||||
end.movePosition(QTextCursor::StartOfLine);
|
||||
end.movePosition(QTextCursor::EndOfLine);
|
||||
|
||||
for (; begin <= end; begin.movePosition(QTextCursor::StartOfLine), begin.movePosition(QTextCursor::Down)) {
|
||||
// loop through line until a nonspace character is reached
|
||||
for (; begin < end; begin.movePosition(QTextCursor::StartOfLine), begin.movePosition(QTextCursor::Down)) {
|
||||
begin.select(QTextCursor::LineUnderCursor);
|
||||
QString line = begin.selectedText();
|
||||
|
||||
if (line.size() == 0)
|
||||
continue;
|
||||
|
||||
// get first nonspace character in line
|
||||
int index;
|
||||
for (index = 0; index != line.size(); ++index)
|
||||
|
@ -326,10 +328,11 @@ void CSVWorld::ScriptEdit::uncommentSelection()
|
|||
|
||||
if (index != line.size() && line[index] == ';')
|
||||
{
|
||||
// remove the semicolon
|
||||
line.remove(index, 1);
|
||||
// put the line back
|
||||
begin.insertText(line);
|
||||
}
|
||||
|
||||
begin.insertText(line);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue