- fix: crash when alt+mouse drag selection
This commit is contained in:
parent
ae7e914788
commit
052f4610ee
1
NEWS.md
1
NEWS.md
|
@ -13,6 +13,7 @@ Red Panda C++ Version 2.4
|
||||||
- fix: function pointers not correctly handle in code parser;
|
- fix: function pointers not correctly handle in code parser;
|
||||||
- fix: var assignment not correctly handled in code parser;
|
- fix: var assignment not correctly handled in code parser;
|
||||||
- fix: function args not correctly handled in code parser;
|
- fix: function args not correctly handled in code parser;
|
||||||
|
- fix: crash when alt+mouse drag selection
|
||||||
|
|
||||||
Red Panda C++ Version 2.3
|
Red Panda C++ Version 2.3
|
||||||
|
|
||||||
|
|
|
@ -33,10 +33,15 @@ enum RunProgramFlag {
|
||||||
};
|
};
|
||||||
|
|
||||||
CompilerManager::CompilerManager(QObject *parent) : QObject(parent),
|
CompilerManager::CompilerManager(QObject *parent) : QObject(parent),
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||||
|
mCompileMutex(),
|
||||||
|
mBackgroundSyntaxCheckMutex(),
|
||||||
|
mRunnerMutex()
|
||||||
|
#else
|
||||||
mCompileMutex(QMutex::Recursive),
|
mCompileMutex(QMutex::Recursive),
|
||||||
mBackgroundSyntaxCheckMutex(QMutex::Recursive),
|
mBackgroundSyntaxCheckMutex(QMutex::Recursive),
|
||||||
mRunnerMutex(QMutex::Recursive)
|
mRunnerMutex(QMutex::Recursive)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
mCompiler = nullptr;
|
mCompiler = nullptr;
|
||||||
mBackgroundSyntaxChecker = nullptr;
|
mBackgroundSyntaxChecker = nullptr;
|
||||||
|
|
|
@ -83,9 +83,15 @@ private:
|
||||||
int mSyntaxCheckIssueCount;
|
int mSyntaxCheckIssueCount;
|
||||||
Compiler* mBackgroundSyntaxChecker;
|
Compiler* mBackgroundSyntaxChecker;
|
||||||
Runner* mRunner;
|
Runner* mRunner;
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||||
|
QRecursiveMutex mCompileMutex;
|
||||||
|
QRecursiveMutex mBackgroundSyntaxCheckMutex;
|
||||||
|
QRecursiveMutex mRunnerMutex;
|
||||||
|
#else
|
||||||
QMutex mCompileMutex;
|
QMutex mCompileMutex;
|
||||||
QMutex mBackgroundSyntaxCheckMutex;
|
QMutex mBackgroundSyntaxCheckMutex;
|
||||||
QMutex mRunnerMutex;
|
QMutex mRunnerMutex;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
class CompileError : public BaseError {
|
class CompileError : public BaseError {
|
||||||
|
|
|
@ -893,7 +893,11 @@ bool Debugger::executing() const
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugReader::DebugReader(Debugger* debugger, QObject *parent) : QThread(parent),
|
DebugReader::DebugReader(Debugger* debugger, QObject *parent) : QThread(parent),
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||||
|
mCmdQueueMutex(),
|
||||||
|
#else
|
||||||
mCmdQueueMutex(QMutex::Recursive),
|
mCmdQueueMutex(QMutex::Recursive),
|
||||||
|
#endif
|
||||||
mStartSemaphore(0)
|
mStartSemaphore(0)
|
||||||
{
|
{
|
||||||
mDebugger = debugger;
|
mDebugger = debugger;
|
||||||
|
|
|
@ -559,7 +559,11 @@ private slots:
|
||||||
private:
|
private:
|
||||||
Debugger *mDebugger;
|
Debugger *mDebugger;
|
||||||
QString mDebuggerPath;
|
QString mDebuggerPath;
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||||
|
QRecursiveMutex mCmdQueueMutex;
|
||||||
|
#else
|
||||||
QMutex mCmdQueueMutex;
|
QMutex mCmdQueueMutex;
|
||||||
|
#endif
|
||||||
QSemaphore mStartSemaphore;
|
QSemaphore mStartSemaphore;
|
||||||
QQueue<PDebugCommand> mCmdQueue;
|
QQueue<PDebugCommand> mCmdQueue;
|
||||||
bool mErrorOccured;
|
bool mErrorOccured;
|
||||||
|
|
|
@ -741,9 +741,16 @@ void Editor::keyPressEvent(QKeyEvent *event)
|
||||||
handled=true;
|
handled=true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
PStatement currentScope = mParser->findScopeStatement(mFilename,caretY());
|
||||||
|
while(currentScope && currentScope->kind==StatementKind::skBlock) {
|
||||||
|
currentScope = currentScope->parentScope.lock();
|
||||||
|
}
|
||||||
|
if (!currentScope || currentScope->kind == StatementKind::skNamespace) {
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//last word is a type keyword, this is a var or param define, and dont show suggestion
|
//last word is a type keyword, this is a var or param define, and dont show suggestion
|
||||||
// if devEditor.UseTabnine then
|
|
||||||
// ShowTabnineCompletion;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PStatement statement = mParser->findStatementOf(
|
PStatement statement = mParser->findStatementOf(
|
||||||
|
@ -756,8 +763,6 @@ void Editor::keyPressEvent(QKeyEvent *event)
|
||||||
|| kind == StatementKind::skEnumType
|
|| kind == StatementKind::skEnumType
|
||||||
|| kind == StatementKind::skTypedef) {
|
|| kind == StatementKind::skTypedef) {
|
||||||
//last word is a typedef/class/struct, this is a var or param define, and dont show suggestion
|
//last word is a typedef/class/struct, this is a var or param define, and dont show suggestion
|
||||||
// if devEditor.UseTabnine then
|
|
||||||
// ShowTabnineCompletion;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,11 @@
|
||||||
|
|
||||||
static QAtomicInt cppParserCount(0);
|
static QAtomicInt cppParserCount(0);
|
||||||
CppParser::CppParser(QObject *parent) : QObject(parent),
|
CppParser::CppParser(QObject *parent) : QObject(parent),
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||||
|
mMutex()
|
||||||
|
#else
|
||||||
mMutex(QMutex::Recursive)
|
mMutex(QMutex::Recursive)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
mParserId = cppParserCount.fetchAndAddRelaxed(1);
|
mParserId = cppParserCount.fetchAndAddRelaxed(1);
|
||||||
mLanguage = ParserLanguage::CPlusPlus;
|
mLanguage = ParserLanguage::CPlusPlus;
|
||||||
|
|
|
@ -641,7 +641,11 @@ private:
|
||||||
QHash<QString,PStatementList> mNamespaces; // namespace and the statements in its scope
|
QHash<QString,PStatementList> mNamespaces; // namespace and the statements in its scope
|
||||||
QSet<QString> mInlineNamespaces;
|
QSet<QString> mInlineNamespaces;
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||||
|
QRecursiveMutex mMutex;
|
||||||
|
#else
|
||||||
QMutex mMutex;
|
QMutex mMutex;
|
||||||
|
#endif
|
||||||
GetFileStreamCallBack mOnGetFileStream;
|
GetFileStreamCallBack mOnGetFileStream;
|
||||||
QMap<QString,KeywordType> mCppKeywords;
|
QMap<QString,KeywordType> mCppKeywords;
|
||||||
QSet<QString> mCppTypeKeywords;
|
QSet<QString> mCppTypeKeywords;
|
||||||
|
|
|
@ -24,7 +24,11 @@
|
||||||
|
|
||||||
static QRegularExpression todoReg("\\b(todo|fixme)\\b", QRegularExpression::CaseInsensitiveOption);
|
static QRegularExpression todoReg("\\b(todo|fixme)\\b", QRegularExpression::CaseInsensitiveOption);
|
||||||
TodoParser::TodoParser(QObject *parent) : QObject(parent),
|
TodoParser::TodoParser(QObject *parent) : QObject(parent),
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||||
|
mMutex()
|
||||||
|
#else
|
||||||
mMutex(QMutex::Recursive)
|
mMutex(QMutex::Recursive)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
mThread = nullptr;
|
mThread = nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,11 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TodoThread* mThread;
|
TodoThread* mThread;
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||||
|
QRecursiveMutex mMutex;
|
||||||
|
#else
|
||||||
QMutex mMutex;
|
QMutex mMutex;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
using PTodoParser = std::shared_ptr<TodoParser>;
|
using PTodoParser = std::shared_ptr<TodoParser>;
|
||||||
|
|
|
@ -26,7 +26,11 @@
|
||||||
#include "../iconsmanager.h"
|
#include "../iconsmanager.h"
|
||||||
|
|
||||||
ClassBrowserModel::ClassBrowserModel(QObject *parent):QAbstractItemModel(parent),
|
ClassBrowserModel::ClassBrowserModel(QObject *parent):QAbstractItemModel(parent),
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||||
|
mMutex()
|
||||||
|
#else
|
||||||
mMutex(QMutex::Recursive)
|
mMutex(QMutex::Recursive)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
mClassBrowserType = ProjectClassBrowserType::CurrentFile;
|
mClassBrowserType = ProjectClassBrowserType::CurrentFile;
|
||||||
mRoot = new ClassBrowserNode();
|
mRoot = new ClassBrowserNode();
|
||||||
|
|
|
@ -85,7 +85,11 @@ private:
|
||||||
PCppParser mParser;
|
PCppParser mParser;
|
||||||
bool mUpdating;
|
bool mUpdating;
|
||||||
int mUpdateCount;
|
int mUpdateCount;
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||||
|
QRecursiveMutex mMutex;
|
||||||
|
#else
|
||||||
QMutex mMutex;
|
QMutex mMutex;
|
||||||
|
#endif
|
||||||
QString mCurrentFile;
|
QString mCurrentFile;
|
||||||
std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > > mColors;
|
std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > > mColors;
|
||||||
ProjectClassBrowserType mClassBrowserType;
|
ProjectClassBrowserType mClassBrowserType;
|
||||||
|
|
|
@ -31,7 +31,11 @@
|
||||||
|
|
||||||
CodeCompletionPopup::CodeCompletionPopup(QWidget *parent) :
|
CodeCompletionPopup::CodeCompletionPopup(QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||||
|
mMutex()
|
||||||
|
#else
|
||||||
mMutex(QMutex::Recursive)
|
mMutex(QMutex::Recursive)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
setWindowFlags(Qt::Popup);
|
setWindowFlags(Qt::Popup);
|
||||||
mListView = new CodeCompletionListView(this);
|
mListView = new CodeCompletionListView(this);
|
||||||
|
|
|
@ -37,6 +37,12 @@ private:
|
||||||
const StatementList* mStatements;
|
const StatementList* mStatements;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class CodeCompletionType {
|
||||||
|
Normal,
|
||||||
|
ComplexType,
|
||||||
|
FunctionWithoutDefinition
|
||||||
|
};
|
||||||
|
|
||||||
class CodeCompletionListItemDelegate: public QStyledItemDelegate {
|
class CodeCompletionListItemDelegate: public QStyledItemDelegate {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -145,7 +151,11 @@ private:
|
||||||
QSet<QString> mAddedStatements;
|
QSet<QString> mAddedStatements;
|
||||||
QString mMemberPhrase;
|
QString mMemberPhrase;
|
||||||
QString mMemberOperator;
|
QString mMemberOperator;
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||||
|
QRecursiveMutex mMutex;
|
||||||
|
#else
|
||||||
QMutex mMutex;
|
QMutex mMutex;
|
||||||
|
#endif
|
||||||
std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > > mColors;
|
std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > > mColors;
|
||||||
CodeCompletionListItemDelegate* mDelegate;
|
CodeCompletionListItemDelegate* mDelegate;
|
||||||
|
|
||||||
|
|
|
@ -1957,23 +1957,23 @@ void SynEdit::doMouseScroll(bool isDragging)
|
||||||
}
|
}
|
||||||
BufferCoord vCaret = displayToBufferPos(C);
|
BufferCoord vCaret = displayToBufferPos(C);
|
||||||
if ((caretX() != vCaret.ch) || (caretY() != vCaret.line)) {
|
if ((caretX() != vCaret.ch) || (caretY() != vCaret.line)) {
|
||||||
if (mActiveSelectionMode == SelectionMode::Column) {
|
// if (mActiveSelectionMode == SelectionMode::Column) {
|
||||||
int startLine=std::min(mBlockBegin.line,mBlockEnd.line);
|
// int startLine=std::min(mBlockBegin.line,mBlockEnd.line);
|
||||||
startLine = std::min(startLine,vCaret.line);
|
// startLine = std::min(startLine,vCaret.line);
|
||||||
int endLine=std::max(mBlockBegin.line,mBlockEnd.line);
|
// int endLine=std::max(mBlockBegin.line,mBlockEnd.line);
|
||||||
endLine = std::max(endLine,vCaret.line);
|
// endLine = std::max(endLine,vCaret.line);
|
||||||
|
|
||||||
int currentCol=displayXY().Column;
|
// int currentCol=displayXY().Column;
|
||||||
for (int i=startLine;i<=endLine;i++) {
|
// for (int i=startLine;i<=endLine;i++) {
|
||||||
QString s = mDocument->getString(i-1);
|
// QString s = mDocument->getString(i-1);
|
||||||
int cols = stringColumns(s,0);
|
// int cols = stringColumns(s,0);
|
||||||
if (cols+1<currentCol) {
|
// if (cols+1<currentCol) {
|
||||||
computeScroll(isDragging);
|
// computeScroll(isDragging);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
// }
|
||||||
// changes to line / column in one go
|
// changes to line / column in one go
|
||||||
incPaintLock();
|
incPaintLock();
|
||||||
auto action = finally([this]{
|
auto action = finally([this]{
|
||||||
|
|
|
@ -35,7 +35,11 @@ Document::Document(const QFont& font, const QFont& nonAsciiFont, QObject *parent
|
||||||
mFontMetrics(font),
|
mFontMetrics(font),
|
||||||
mNonAsciiFontMetrics(nonAsciiFont),
|
mNonAsciiFontMetrics(nonAsciiFont),
|
||||||
mTabWidth(4),
|
mTabWidth(4),
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||||
|
mMutex()
|
||||||
|
#else
|
||||||
mMutex(QMutex::Recursive)
|
mMutex(QMutex::Recursive)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
|
|
||||||
mAppendNewLineAtEOF = true;
|
mAppendNewLineAtEOF = true;
|
||||||
|
|
|
@ -146,7 +146,11 @@ private:
|
||||||
bool mAppendNewLineAtEOF;
|
bool mAppendNewLineAtEOF;
|
||||||
int mIndexOfLongestLine;
|
int mIndexOfLongestLine;
|
||||||
int mUpdateCount;
|
int mUpdateCount;
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||||
|
QRecursiveMutex mMutex;
|
||||||
|
#else
|
||||||
QMutex mMutex;
|
QMutex mMutex;
|
||||||
|
#endif
|
||||||
|
|
||||||
int calculateLineColumns(int Index);
|
int calculateLineColumns(int Index);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue