- optimization: use QString::constData() instead of QString::data() if possible
- fix: Can't correctly parse template parameters that contains "->", like "std::queue<std::function<auto()->void>>";
This commit is contained in:
parent
f4d3ebc9bc
commit
454dcbadcb
2
NEWS.md
2
NEWS.md
|
@ -1,6 +1,7 @@
|
|||
Red Panda C++ Version 3.1
|
||||
|
||||
- fix: Can't correctly select in column mode.
|
||||
- fix: Can't correctly parse template parameters that contains "->", like "std::queue<std::function<auto()->void>>";
|
||||
|
||||
Red Panda C++ Version 3.0
|
||||
|
||||
|
@ -174,6 +175,7 @@ Red Panda C++ Version 3.0
|
|||
- enhancement: Show full filepath in the tooltip of editor tab.
|
||||
|
||||
Red Panda C++ Version 2.26
|
||||
|
||||
- enhancement: Code suggestion for embedded std::vectors.
|
||||
- change: Use ctrl+mouseMove event to highlight jumpable symbols (instead of ctrl+tooltip).
|
||||
- enhancement: Auto adjust position of the suggestion popup window.
|
||||
|
|
|
@ -49,7 +49,8 @@ void CppTokenizer::tokenize(const QStringList &buffer)
|
|||
mBufferStr+='\n';
|
||||
mBufferStr+=mBuffer[i];
|
||||
}
|
||||
mBufferStr.append(QChar(0));
|
||||
//QByteArray is always '\0'-terminated unless it's created by QbyteArray::fromRawData()
|
||||
//mBufferStr.append(QChar(0));
|
||||
mStart = mBufferStr.constData();
|
||||
mCurrent = mStart;
|
||||
mLineCount = mStart;
|
||||
|
@ -695,8 +696,8 @@ bool CppTokenizer::skipAngleBracketPair()
|
|||
return false;
|
||||
case '-':
|
||||
if (*(mCurrent+1)=='>') {
|
||||
mCurrent=backup;
|
||||
return false;
|
||||
mCurrent+=2;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case '.':
|
||||
|
|
|
@ -89,7 +89,7 @@ bool ProblemCaseValidator::equalIgnoringSpaces(const QString &s1, const QString
|
|||
QStringList ProblemCaseValidator::split(const QString &s)
|
||||
{
|
||||
QStringList result;
|
||||
const QChar* p = s.data();
|
||||
const QChar* p = getNullTerminatedStringData(s);
|
||||
const QChar* start = p;
|
||||
while (p->unicode()!=0) {
|
||||
if (p->isSpace()) {
|
||||
|
|
|
@ -252,7 +252,7 @@ QString QConsole::selText()
|
|||
QString s = mContents.getLine(Last);
|
||||
if (Last == mContents.lines())
|
||||
s+= this->mCommand;
|
||||
result.append(s.data(), ColTo);
|
||||
result.append(s.constData(), ColTo);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4498,7 +4498,7 @@ QString QSynEdit::selText() const
|
|||
result+=lineBreak();
|
||||
}
|
||||
const QString &line = mDocument->getLine(lastLine);
|
||||
result.append(line.data(), charTo-1);
|
||||
result.append(line.constData(), charTo-1);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
#include "asm.h"
|
||||
#include "../constants.h"
|
||||
#include <qt_utils/utils.h>
|
||||
#include <QDebug>
|
||||
|
||||
namespace QSynedit {
|
||||
|
@ -1706,7 +1707,7 @@ void ASMSyntaxer::next()
|
|||
void ASMSyntaxer::setLine(const QString &newLine, int lineNumber)
|
||||
{
|
||||
mLineString = newLine;
|
||||
mLine = mLineString.data();
|
||||
mLine = getNullTerminatedStringData(mLineString);
|
||||
mLineNumber = lineNumber;
|
||||
mRun = 0;
|
||||
next();
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
static const QSet<QString> Directives;
|
||||
static const QSet<QString> ATTDirectives;
|
||||
private:
|
||||
QChar* mLine;
|
||||
const QChar* mLine;
|
||||
QString mLineString;
|
||||
int mLineNumber;
|
||||
int mRun;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
#include "glsl.h"
|
||||
#include "../constants.h"
|
||||
#include <qt_utils/utils.h>
|
||||
|
||||
#include <QFont>
|
||||
|
||||
|
@ -1360,7 +1361,7 @@ void GLSLSyntaxer::next()
|
|||
void GLSLSyntaxer::setLine(const QString &newLine, int lineNumber)
|
||||
{
|
||||
mLineString = newLine;
|
||||
mLine = mLineString.data();
|
||||
mLine = getNullTerminatedStringData(mLineString);
|
||||
mLineNumber = lineNumber;
|
||||
mRun = 0;
|
||||
mRange.blockStarted = 0;
|
||||
|
|
|
@ -134,7 +134,7 @@ private:
|
|||
SyntaxState mRange;
|
||||
// SynRangeState mSpaceRange;
|
||||
QString mLineString;
|
||||
QChar* mLine;
|
||||
const QChar* mLine;
|
||||
int mLineSize;
|
||||
int mRun;
|
||||
int mStringLen;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
#include "makefile.h"
|
||||
#include "../constants.h"
|
||||
#include <qt_utils/utils.h>
|
||||
//#include <QDebug>
|
||||
|
||||
namespace QSynedit {
|
||||
|
@ -643,7 +644,7 @@ void MakefileSyntaxer::next()
|
|||
void MakefileSyntaxer::setLine(const QString &newLine, int lineNumber)
|
||||
{
|
||||
mLineString = newLine;
|
||||
mLine = mLineString.data();
|
||||
mLine = getNullTerminatedStringData(mLineString);
|
||||
mLineNumber = lineNumber;
|
||||
mRun = 0;
|
||||
next();
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
|
||||
static const QSet<QString> Directives;
|
||||
private:
|
||||
QChar* mLine;
|
||||
const QChar* mLine;
|
||||
QString mLineString;
|
||||
int mLineNumber;
|
||||
int mRun;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
#include "textfile.h"
|
||||
#include "../constants.h"
|
||||
#include <qt_utils/utils.h>
|
||||
//#include <QDebug>
|
||||
|
||||
namespace QSynedit {
|
||||
|
@ -102,7 +103,7 @@ void TextSyntaxer::next()
|
|||
void TextSyntaxer::setLine(const QString &newLine, int lineNumber)
|
||||
{
|
||||
mLineString = newLine;
|
||||
mLine = mLineString.data();
|
||||
mLine = getNullTerminatedStringData(mLineString);
|
||||
mLineNumber = lineNumber;
|
||||
mRun = 0;
|
||||
next();
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
|
||||
static const QSet<QString> Directives;
|
||||
private:
|
||||
QChar* mLine;
|
||||
const QChar* mLine;
|
||||
QString mLineString;
|
||||
int mLineNumber;
|
||||
int mRun;
|
||||
|
|
|
@ -756,3 +756,12 @@ QString replacePrefix(const QString &oldString, const QString &prefix, const QSt
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
const QChar *getNullTerminatedStringData(const QString &str)
|
||||
{
|
||||
const QChar* result = str.constData();
|
||||
if (result[str.size()]!=QChar(0)) {
|
||||
result = str.data();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -69,6 +69,8 @@ public:
|
|||
/* text processing utils */
|
||||
const QByteArray guessTextEncoding(const QByteArray& text);
|
||||
|
||||
const QChar *getNullTerminatedStringData(const QString& str);
|
||||
|
||||
bool isBinaryContent(const QByteArray& text);
|
||||
bool isTextAllAscii(const QByteArray& text);
|
||||
bool isTextAllAscii(const QString& text);
|
||||
|
|
Loading…
Reference in New Issue