From be2c1ec77fbc1c65d6bad25da9151690ec43856c Mon Sep 17 00:00:00 2001 From: "royqh1979@gmail.com" Date: Sat, 13 Nov 2021 13:03:42 +0800 Subject: [PATCH] - fix: greatly reduces paste time --- NEWS.md | 1 + RedPandaIDE/qsynedit/SynEdit.cpp | 23 ++++++++++++++--------- RedPandaIDE/qsynedit/SynEdit.h | 2 +- RedPandaIDE/qsynedit/TextBuffer.cpp | 5 +++-- RedPandaIDE/qsynedit/TextBuffer.h | 2 +- RedPandaIDE/systemconsts.h | 2 +- 6 files changed, 21 insertions(+), 14 deletions(-) diff --git a/NEWS.md b/NEWS.md index fe25fef1..c8221482 100644 --- a/NEWS.md +++ b/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+) diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp index c6bbccaf..f5f337ed 100644 --- a/RedPandaIDE/qsynedit/SynEdit.cpp +++ b/RedPandaIDE/qsynedit/SynEdit.cpp @@ -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 (PfString = s; mList[Index]->fColumns = -1; - emit putted(Index,1); + if (notify) + emit putted(Index,1); endUpdate(); } } diff --git a/RedPandaIDE/qsynedit/TextBuffer.h b/RedPandaIDE/qsynedit/TextBuffer.h index 50b387dd..4d484c5b 100644 --- a/RedPandaIDE/qsynedit/TextBuffer.h +++ b/RedPandaIDE/qsynedit/TextBuffer.h @@ -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(); diff --git a/RedPandaIDE/systemconsts.h b/RedPandaIDE/systemconsts.h index de3b4b01..cecd1453 100644 --- a/RedPandaIDE/systemconsts.h +++ b/RedPandaIDE/systemconsts.h @@ -3,7 +3,7 @@ #include -#define DEVCPP_VERSION "beta.0.8.6" +#define DEVCPP_VERSION "beta.0.8.8" #define APP_SETTSINGS_FILENAME "redpandacpp.ini" #ifdef Q_OS_WIN