- fix: Crash when drag the selection beyond the end of the document.
This commit is contained in:
parent
cdcf525157
commit
6eded18fd6
2
NEWS.md
2
NEWS.md
|
@ -3,6 +3,8 @@ Red Panda C++ Version 2.19
|
||||||
- fix: Crash when directive line ends with '\' and at the last line.
|
- fix: Crash when directive line ends with '\' and at the last line.
|
||||||
- fix: The option "Minimal indent for a continuous conditional beloning to a conditional header:" for formatter is not correct.
|
- fix: The option "Minimal indent for a continuous conditional beloning to a conditional header:" for formatter is not correct.
|
||||||
- fix: Crash when a project is removed from the disk while it is openned in RedPanda-C++.
|
- fix: Crash when a project is removed from the disk while it is openned in RedPanda-C++.
|
||||||
|
- fix: The option "Open CPU info dialog when signal received" can't be correctly set in the options dialog's debugger page.
|
||||||
|
- fix: Crash when drag the selection beyond the end of the document.
|
||||||
|
|
||||||
Red Panda C++ Version 2.18
|
Red Panda C++ Version 2.18
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ Document::Document(const QFont& font, const QFont& nonAsciiFont, QObject *parent
|
||||||
mCharWidth = mFontMetrics.horizontalAdvance("M");
|
mCharWidth = mFontMetrics.horizontalAdvance("M");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ListIndexOutOfBounds(int index) {
|
static void listIndexOutOfBounds(int index) {
|
||||||
throw IndexOutOfRange(index);
|
throw IndexOutOfRange(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ SyntaxState Document::getSyntaxState(int index)
|
||||||
if (index>=0 && index < mLines.size()) {
|
if (index>=0 && index < mLines.size()) {
|
||||||
return mLines[index]->syntaxState;
|
return mLines[index]->syntaxState;
|
||||||
} else {
|
} else {
|
||||||
ListIndexOutOfBounds(index);
|
listIndexOutOfBounds(index);
|
||||||
}
|
}
|
||||||
return SyntaxState();
|
return SyntaxState();
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ void Document::setSyntaxState(int Index, const SyntaxState& range)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (Index<0 || Index>=mLines.count()) {
|
if (Index<0 || Index>=mLines.count()) {
|
||||||
ListIndexOutOfBounds(Index);
|
listIndexOutOfBounds(Index);
|
||||||
}
|
}
|
||||||
//beginUpdate();
|
//beginUpdate();
|
||||||
mLines[Index]->syntaxState = range;
|
mLines[Index]->syntaxState = range;
|
||||||
|
@ -341,7 +341,7 @@ void Document::deleteLines(int index, int numLines)
|
||||||
if (numLines<=0)
|
if (numLines<=0)
|
||||||
return;
|
return;
|
||||||
if ((index < 0) || (index >= mLines.count())) {
|
if ((index < 0) || (index >= mLines.count())) {
|
||||||
ListIndexOutOfBounds(index);
|
listIndexOutOfBounds(index);
|
||||||
}
|
}
|
||||||
beginUpdate();
|
beginUpdate();
|
||||||
auto action = finally([this]{
|
auto action = finally([this]{
|
||||||
|
@ -366,10 +366,10 @@ void Document::exchange(int index1, int index2)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if ((index1 < 0) || (index1 >= mLines.count())) {
|
if ((index1 < 0) || (index1 >= mLines.count())) {
|
||||||
ListIndexOutOfBounds(index1);
|
listIndexOutOfBounds(index1);
|
||||||
}
|
}
|
||||||
if ((index2 < 0) || (index2 >= mLines.count())) {
|
if ((index2 < 0) || (index2 >= mLines.count())) {
|
||||||
ListIndexOutOfBounds(index2);
|
listIndexOutOfBounds(index2);
|
||||||
}
|
}
|
||||||
beginUpdate();
|
beginUpdate();
|
||||||
PDocumentLine temp = mLines[index1];
|
PDocumentLine temp = mLines[index1];
|
||||||
|
@ -388,7 +388,7 @@ void Document::insertLine(int index, const QString &s)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if ((index < 0) || (index > mLines.count())) {
|
if ((index < 0) || (index > mLines.count())) {
|
||||||
ListIndexOutOfBounds(index);
|
listIndexOutOfBounds(index);
|
||||||
}
|
}
|
||||||
beginUpdate();
|
beginUpdate();
|
||||||
insertItem(index, s);
|
insertItem(index, s);
|
||||||
|
@ -400,7 +400,7 @@ void Document::deleteAt(int index)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if ((index < 0) || (index >= mLines.count())) {
|
if ((index < 0) || (index >= mLines.count())) {
|
||||||
ListIndexOutOfBounds(index);
|
listIndexOutOfBounds(index);
|
||||||
}
|
}
|
||||||
beginUpdate();
|
beginUpdate();
|
||||||
if (mIndexOfLongestLine == index)
|
if (mIndexOfLongestLine == index)
|
||||||
|
@ -432,7 +432,7 @@ void Document::putLine(int index, const QString &s, bool notify) {
|
||||||
addLine(s);
|
addLine(s);
|
||||||
} else {
|
} else {
|
||||||
if (index<0 || index>=mLines.count()) {
|
if (index<0 || index>=mLines.count()) {
|
||||||
ListIndexOutOfBounds(index);
|
listIndexOutOfBounds(index);
|
||||||
}
|
}
|
||||||
beginUpdate();
|
beginUpdate();
|
||||||
int oldColumns = mLines[index]->columns;
|
int oldColumns = mLines[index]->columns;
|
||||||
|
@ -470,7 +470,7 @@ void Document::insertLines(int index, int numLines)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (index<0 || index>mLines.count()) {
|
if (index<0 || index>mLines.count()) {
|
||||||
ListIndexOutOfBounds(index);
|
listIndexOutOfBounds(index);
|
||||||
}
|
}
|
||||||
if (numLines<=0)
|
if (numLines<=0)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -6352,6 +6352,13 @@ void QSynEdit::dropEvent(QDropEvent *event)
|
||||||
mDropped = true;
|
mDropped = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (coord.line<=0 || coord.line>=mDocument->lengthOfLongestLine()) {
|
||||||
|
//do nothing if drag out of range
|
||||||
|
event->acceptProposedAction();
|
||||||
|
mDropped = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int topLine = mTopLine;
|
int topLine = mTopLine;
|
||||||
int leftChar = mLeftChar;
|
int leftChar = mLeftChar;
|
||||||
QStringList text=splitStrings(event->mimeData()->text());
|
QStringList text=splitStrings(event->mimeData()->text());
|
||||||
|
|
Loading…
Reference in New Issue