- fix: index of the longest line not correctly updated when insert/delete multiple lines ( which will cause selection errors)
This commit is contained in:
parent
1a7322f562
commit
d9259fb9e4
1
NEWS.md
1
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
|
||||
|
|
|
@ -3482,7 +3482,6 @@ void Editor::updateFunctionTip(bool showTip)
|
|||
if (currentLine>=document()->count())
|
||||
return;
|
||||
QChar ch=lastNonSpaceChar(currentLine,currentChar);
|
||||
qDebug()<<ch;
|
||||
if (ch!="(" && ch!=",")
|
||||
return;
|
||||
|
||||
|
|
|
@ -348,8 +348,12 @@ void SynDocument::deleteLines(int Index, int NumLines)
|
|||
auto action = finally([this]{
|
||||
endUpdate();
|
||||
});
|
||||
if (mIndexOfLongestLine>=Index && (mIndexOfLongestLine <Index+NumLines)) {
|
||||
mIndexOfLongestLine = - 1;
|
||||
if (mIndexOfLongestLine>=Index) {
|
||||
if (mIndexOfLongestLine <Index+NumLines) {
|
||||
mIndexOfLongestLine = -1;
|
||||
} else {
|
||||
mIndexOfLongestLine -= NumLines;
|
||||
}
|
||||
}
|
||||
int LinesAfter = mLines.count() - (Index + NumLines);
|
||||
if (LinesAfter < 0) {
|
||||
|
@ -482,6 +486,7 @@ void SynDocument::insertLines(int Index, int NumLines)
|
|||
auto action = finally([this]{
|
||||
endUpdate();
|
||||
});
|
||||
mIndexOfLongestLine = -1;
|
||||
PSynDocumentLine line;
|
||||
mLines.insert(Index,NumLines,line);
|
||||
for (int i=Index;i<Index+NumLines;i++) {
|
||||
|
@ -503,6 +508,7 @@ void SynDocument::insertStrings(int Index, const QStringList &NewStrings)
|
|||
auto action = finally([this]{
|
||||
endUpdate();
|
||||
});
|
||||
mIndexOfLongestLine = -1;
|
||||
PSynDocumentLine line;
|
||||
mLines.insert(Index,NewStrings.length(),line);
|
||||
for (int i=0;i<NewStrings.length();i++) {
|
||||
|
@ -579,9 +585,13 @@ void SynDocument::loadFromFile(const QString& filename, const QByteArray& encodi
|
|||
if (!file.open(QFile::ReadOnly ))
|
||||
throw FileError(tr("Can't open file '%1' for read!").arg(file.fileName()));
|
||||
beginUpdate();
|
||||
internalClear();
|
||||
auto action = finally([this]{
|
||||
if (mLines.count()>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<PCharsetInfo> 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()<<encodingName;
|
||||
//qDebug()<<encodingName;
|
||||
realEncoding = encodingName;
|
||||
emit inserted(0,mLines.count());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -694,7 +701,6 @@ void SynDocument::loadFromFile(const QString& filename, const QByteArray& encodi
|
|||
}
|
||||
addItem(line);
|
||||
}
|
||||
emit inserted(0,mLines.count());
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue