- fix: greatly reduces paste time
This commit is contained in:
parent
a6e8846282
commit
be2c1ec77f
1
NEWS.md
1
NEWS.md
|
@ -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+)
|
||||
|
|
|
@ -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;
|
||||
|
@ -5090,9 +5095,9 @@ int SynEdit::insertTextByNormalMode(const QString &Value)
|
|||
Start = P;
|
||||
P = GetEOL(Value,Start);
|
||||
if (P == Start) {
|
||||
if (P<Value.length())
|
||||
Str = GetLeftSpacing(calcIndentSpaces(caretY,"",true),true);
|
||||
else
|
||||
if (P<Value.length())
|
||||
Str = GetLeftSpacing(calcIndentSpaces(caretY,"",true),true);
|
||||
else
|
||||
Str = sRightSide;
|
||||
} else {
|
||||
Str = Value.mid(Start, P-Start);
|
||||
|
@ -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++;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,7 +409,8 @@ void SynEditStringList::putString(int Index, const QString &s) {
|
|||
mIndexOfLongestLine = -1;
|
||||
mList[Index]->fString = s;
|
||||
mList[Index]->fColumns = -1;
|
||||
emit putted(Index,1);
|
||||
if (notify)
|
||||
emit putted(Index,1);
|
||||
endUpdate();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue