forked from mirror/openmw-tes3mp
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);
|
begin.movePosition(QTextCursor::StartOfLine);
|
||||||
|
|
||||||
end.setPosition(end.selectionEnd());
|
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(";");
|
begin.insertText(";");
|
||||||
}
|
}
|
||||||
|
@ -309,13 +309,15 @@ void CSVWorld::ScriptEdit::uncommentSelection()
|
||||||
begin.movePosition(QTextCursor::StartOfLine);
|
begin.movePosition(QTextCursor::StartOfLine);
|
||||||
|
|
||||||
end.setPosition(end.selectionEnd());
|
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)) {
|
||||||
// loop through line until a nonspace character is reached
|
|
||||||
begin.select(QTextCursor::LineUnderCursor);
|
begin.select(QTextCursor::LineUnderCursor);
|
||||||
QString line = begin.selectedText();
|
QString line = begin.selectedText();
|
||||||
|
|
||||||
|
if (line.size() == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
// get first nonspace character in line
|
// get first nonspace character in line
|
||||||
int index;
|
int index;
|
||||||
for (index = 0; index != line.size(); ++index)
|
for (index = 0; index != line.size(); ++index)
|
||||||
|
@ -326,10 +328,11 @@ void CSVWorld::ScriptEdit::uncommentSelection()
|
||||||
|
|
||||||
if (index != line.size() && line[index] == ';')
|
if (index != line.size() && line[index] == ';')
|
||||||
{
|
{
|
||||||
|
// remove the semicolon
|
||||||
line.remove(index, 1);
|
line.remove(index, 1);
|
||||||
|
// put the line back
|
||||||
|
begin.insertText(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
begin.insertText(line);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue