From d9259fb9e4018c0a9d80ccf21e427631d6c603b2 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Sun, 24 Apr 2022 09:50:30 +0800 Subject: [PATCH] - fix: index of the longest line not correctly updated when insert/delete multiple lines ( which will cause selection errors) --- NEWS.md | 1 + RedPandaIDE/editor.cpp | 1 - RedPandaIDE/qsynedit/TextBuffer.cpp | 20 +++++++++++++------- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/NEWS.md b/NEWS.md index 3ec7b242..16fe6dcc 100644 --- a/NEWS.md +++ b/NEWS.md @@ -10,6 +10,7 @@ Red Panda C++ Version 1.0.5 - enhancement: only show function tips when cursor is after ',' or '('. - enhancement: when auto complete function names, only append '(' if before identifier or "/' - update highconstrast icon set + - fix: index of the longest line not correctly updated when insert/delete multiple lines ( which will cause selection errors) Red Panda C++ Version 1.0.4 - fix: hide function tips, when move or resize the main window diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 759abd10..fb7f079e 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -3482,7 +3482,6 @@ void Editor::updateFunctionTip(bool showTip) if (currentLine>=document()->count()) return; QChar ch=lastNonSpaceChar(currentLine,currentChar); - qDebug()<=Index && (mIndexOfLongestLine =Index) { + if (mIndexOfLongestLine 0) + emit inserted(0,mLines.count()); endUpdate(); }); + mIndexOfLongestLine = -1; //test for utf8 / utf 8 bom if (encoding == ENCODING_AUTO_DETECT) { if (file.atEnd()) { @@ -636,7 +646,6 @@ void SynDocument::loadFromFile(const QString& filename, const QByteArray& encodi } line = file.readLine(); } - emit inserted(0,mLines.count()); if (!needReread) { if (allAscii) realEncoding = ENCODING_ASCII; @@ -646,7 +655,6 @@ void SynDocument::loadFromFile(const QString& filename, const QByteArray& encodi QList charsets = pCharsetInfoManager->findCharsetByLocale(pCharsetInfoManager->localeName()); if (!charsets.isEmpty()) { if (tryLoadFileByEncoding(realEncoding,file)) { - emit inserted(0,mLines.count()); return; } @@ -659,9 +667,8 @@ void SynDocument::loadFromFile(const QString& filename, const QByteArray& encodi if (encodingName == ENCODING_UTF8) continue; if (tryLoadFileByEncoding(encodingName,file)) { - qDebug()<