- fix: greatly reduces paste time

This commit is contained in:
royqh1979@gmail.com 2021-11-13 13:03:42 +08:00
parent a6e8846282
commit be2c1ec77f
6 changed files with 21 additions and 14 deletions

View File

@ -6,6 +6,7 @@ Version 0.8.7 For Dev-C++ 7 Beta
- enhancement: drag & drop text in the editor
- enhancement: auto calcuate caret line size basing on font size
- enhancement: shift+mouse wheel to scroll horizontally
- fix: greatly reduces paste time
Version 0.8.6 For Dev-C++ 7 Beta
- enhancement: greatly reduces memory usage for symbol parsing ( memory needed for bits/stdc++.h reduced from 150m+ to 80m+)

View File

@ -4942,12 +4942,13 @@ void SynEdit::doLinesInserted(int firstLine, int count)
// end;
}
void SynEdit::properSetLine(int ALine, const QString &ALineText)
void SynEdit::properSetLine(int ALine, const QString &ALineText, bool notify)
{
if (mOptions.testFlag(eoTrimTrailingSpaces))
mLines->putString(ALine,TrimRight(ALineText));
else
mLines->putString(ALine,ALineText);
if (mOptions.testFlag(eoTrimTrailingSpaces)) {
mLines->putString(ALine,TrimRight(ALineText),notify);
} else {
mLines->putString(ALine,ALineText,notify);
}
}
void SynEdit::deleteSelection(const BufferCoord &BB, const BufferCoord &BE)
@ -5041,6 +5042,10 @@ void SynEdit::insertText(const QString &Value, SynSelectionMode PasteMode,bool A
int SynEdit::insertTextByNormalMode(const QString &Value)
{
mLines->beginUpdate();
auto actionLines = finally([this] {
mLines->endUpdate();
});
QString sLeftSide;
QString sRightSide;
QString Str;
@ -5103,7 +5108,7 @@ int SynEdit::insertTextByNormalMode(const QString &Value)
Str = GetLeftSpacing(indentSpaces,true)+TrimLeft(Str);
}
}
properSetLine(caretY - 1, Str);
properSetLine(caretY - 1, Str,false);
rescanRange(caretY);
Result++;
}

View File

@ -504,7 +504,7 @@ private:
const QString& Value, bool AddToUndoList);
void doLinesDeleted(int FirstLine, int Count);
void doLinesInserted(int FirstLine, int Count);
void properSetLine(int ALine, const QString& ALineText);
void properSetLine(int ALine, const QString& ALineText, bool notify = true);
void deleteSelection(const BufferCoord& BB, const BufferCoord& BE);
void insertText(const QString& Value, SynSelectionMode PasteMode,bool AddToUndoList);
int insertTextByNormalMode(const QString& Value);

View File

@ -397,7 +397,7 @@ QString SynEditStringList::getTextStr() const
return result;
}
void SynEditStringList::putString(int Index, const QString &s) {
void SynEditStringList::putString(int Index, const QString &s, bool notify) {
QMutexLocker locker(&mMutex);
if (Index == mList.count()) {
add(s);
@ -409,6 +409,7 @@ void SynEditStringList::putString(int Index, const QString &s) {
mIndexOfLongestLine = -1;
mList[Index]->fString = s;
mList[Index]->fColumns = -1;
if (notify)
emit putted(Index,1);
endUpdate();
}

View File

@ -67,7 +67,7 @@ public:
void setContents(const QStringList& text);
QStringList contents();
void putString(int Index, const QString& s);
void putString(int Index, const QString& s, bool notify=true);
void putObject(int Index, void * AObject);
void beginUpdate();

View File

@ -3,7 +3,7 @@
#include <QStringList>
#define DEVCPP_VERSION "beta.0.8.6"
#define DEVCPP_VERSION "beta.0.8.8"
#define APP_SETTSINGS_FILENAME "redpandacpp.ini"
#ifdef Q_OS_WIN