optimize editing
This commit is contained in:
parent
e29b7c0148
commit
30e7751abf
|
@ -3268,7 +3268,7 @@ void QSynEdit::updateModifiedStatus()
|
||||||
emit statusChanged(StatusChange::ModifyChanged);
|
emit statusChanged(StatusChange::ModifyChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QSynEdit::reparseLines(int startLine, int endLine)
|
int QSynEdit::reparseLines(int startLine, int endLine)
|
||||||
{
|
{
|
||||||
|
|
||||||
SyntaxState state;
|
SyntaxState state;
|
||||||
|
@ -3276,7 +3276,7 @@ void QSynEdit::reparseLines(int startLine, int endLine)
|
||||||
endLine = std::min(endLine, mDocument->count());
|
endLine = std::min(endLine, mDocument->count());
|
||||||
|
|
||||||
if (startLine >= endLine)
|
if (startLine >= endLine)
|
||||||
return;
|
return startLine;
|
||||||
|
|
||||||
if (startLine == 0) {
|
if (startLine == 0) {
|
||||||
mSyntaxer->resetState();
|
mSyntaxer->resetState();
|
||||||
|
@ -3288,15 +3288,18 @@ void QSynEdit::reparseLines(int startLine, int endLine)
|
||||||
mSyntaxer->setLine(mDocument->getLine(line), line);
|
mSyntaxer->setLine(mDocument->getLine(line), line);
|
||||||
mSyntaxer->nextToEol();
|
mSyntaxer->nextToEol();
|
||||||
state = mSyntaxer->getState();
|
state = mSyntaxer->getState();
|
||||||
|
if (line >= endLine && state == mDocument->getSyntaxState(line)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
mDocument->setSyntaxState(line,state);
|
mDocument->setSyntaxState(line,state);
|
||||||
line++ ;
|
line++;
|
||||||
} while (line < endLine);
|
} while (line < endLine);
|
||||||
|
|
||||||
if (mEditingCount>0)
|
if (mEditingCount>0)
|
||||||
return;
|
return line;
|
||||||
if (useCodeFolding())
|
if (useCodeFolding())
|
||||||
rescanFolds();
|
rescanFolds();
|
||||||
return ;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
// void QSynEdit::reparseLine(int line)
|
// void QSynEdit::reparseLine(int line)
|
||||||
|
@ -6537,7 +6540,7 @@ void QSynEdit::onLinesDeleted(int line, int count)
|
||||||
if (useCodeFolding())
|
if (useCodeFolding())
|
||||||
foldOnLinesDeleted(line + 1, count);
|
foldOnLinesDeleted(line + 1, count);
|
||||||
if (mSyntaxer->needsLineState()) {
|
if (mSyntaxer->needsLineState()) {
|
||||||
reparseLines(line, mDocument->count());
|
reparseLines(line, line + 1);
|
||||||
}
|
}
|
||||||
invalidateLines(line + 1, INT_MAX);
|
invalidateLines(line + 1, INT_MAX);
|
||||||
}
|
}
|
||||||
|
@ -6547,7 +6550,7 @@ void QSynEdit::onLinesInserted(int line, int count)
|
||||||
if (useCodeFolding())
|
if (useCodeFolding())
|
||||||
foldOnLinesInserted(line + 1, count);
|
foldOnLinesInserted(line + 1, count);
|
||||||
if (mSyntaxer->needsLineState()) {
|
if (mSyntaxer->needsLineState()) {
|
||||||
reparseLines(line, mDocument->count());
|
reparseLines(line, line + count);
|
||||||
} else {
|
} else {
|
||||||
// new lines should be parsed
|
// new lines should be parsed
|
||||||
reparseLines(line, line + count);
|
reparseLines(line, line + count);
|
||||||
|
@ -6558,10 +6561,10 @@ void QSynEdit::onLinesInserted(int line, int count)
|
||||||
void QSynEdit::onLinesPutted(int line)
|
void QSynEdit::onLinesPutted(int line)
|
||||||
{
|
{
|
||||||
if (mSyntaxer->needsLineState()) {
|
if (mSyntaxer->needsLineState()) {
|
||||||
reparseLines(line, mDocument->count());
|
reparseLines(line, line + 1);
|
||||||
invalidateLines(line + 1, INT_MAX);
|
invalidateLines(line + 1, INT_MAX);
|
||||||
} else {
|
} else {
|
||||||
reparseLines(line, line+1);
|
reparseLines(line, line + 1);
|
||||||
invalidateLine( line + 1 );
|
invalidateLine( line + 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -529,7 +529,7 @@ private:
|
||||||
void recalcCharExtent();
|
void recalcCharExtent();
|
||||||
QString expandAtWideGlyphs(const QString& S);
|
QString expandAtWideGlyphs(const QString& S);
|
||||||
void updateModifiedStatus();
|
void updateModifiedStatus();
|
||||||
void reparseLines(int startLine, int endLine);
|
int reparseLines(int startLine, int endLine);
|
||||||
//void reparseLine(int line);
|
//void reparseLine(int line);
|
||||||
void uncollapse(PCodeFoldingRange FoldRange);
|
void uncollapse(PCodeFoldingRange FoldRange);
|
||||||
void collapse(PCodeFoldingRange FoldRange);
|
void collapse(PCodeFoldingRange FoldRange);
|
||||||
|
|
|
@ -169,6 +169,7 @@ bool SyntaxState::operator==(const SyntaxState &s2)
|
||||||
&& (parenthesisLevel == s2.parenthesisLevel) // current parenthesis embedding level (needed by rainbow color)
|
&& (parenthesisLevel == s2.parenthesisLevel) // current parenthesis embedding level (needed by rainbow color)
|
||||||
&& (indents == s2.indents)
|
&& (indents == s2.indents)
|
||||||
&& (lastUnindent == s2.lastUnindent)
|
&& (lastUnindent == s2.lastUnindent)
|
||||||
|
&& (extraData == s2.extraData)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue