work save
This commit is contained in:
parent
7225a25a65
commit
83116306a9
|
@ -598,8 +598,8 @@ PColorSchemeItem ColorManager::getItem(const QString &schemeName, const QString
|
|||
bool ColorManager::isValidName(const QString &name)
|
||||
{
|
||||
for (QChar ch:name) {
|
||||
if (!((ch == ' ') or (ch>='a' && ch<='z') or (ch>='A' && ch <= 'Z')
|
||||
or (ch>='0' && ch<='9') or (ch == '-') ))
|
||||
if (!((ch == ' ') || (ch>='a' && ch<='z') || (ch>='A' && ch <= 'Z')
|
||||
|| (ch>='0' && ch<='9') || (ch == '-') ))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -707,10 +707,10 @@ AnnotationType DebugReader::getNextAnnotation()
|
|||
QString DebugReader::getNextFilledLine()
|
||||
{
|
||||
// Walk up to an enter sequence
|
||||
while (mIndex<mOutput.length() && mOutput[mIndex]!=13 && mOutput[mIndex]!=10 && mOutput[mIndex]!=0)
|
||||
while (mIndex<mOutput.length() && mOutput[mIndex]!='\r' && mOutput[mIndex]!='\n' && mOutput[mIndex]!=0)
|
||||
mIndex++;
|
||||
// Skip enter sequences (CRLF, CR, LF, etc.)
|
||||
while (mIndex<mOutput.length() && mOutput[mIndex]==13 && mOutput[mIndex]==10 && mOutput[mIndex]==0)
|
||||
while (mIndex<mOutput.length() && mOutput[mIndex]=='\r' && mOutput[mIndex]=='\n' && mOutput[mIndex]==0)
|
||||
mIndex++;
|
||||
// Return next line
|
||||
return getRemainingLine();
|
||||
|
@ -719,18 +719,18 @@ QString DebugReader::getNextFilledLine()
|
|||
QString DebugReader::getNextLine()
|
||||
{
|
||||
// Walk up to an enter sequence
|
||||
while (mIndex<mOutput.length() && mOutput[mIndex]!=13 && mOutput[mIndex]!=10 && mOutput[mIndex]!=0)
|
||||
while (mIndex<mOutput.length() && mOutput[mIndex]!='\r' && mOutput[mIndex]!='\n' && mOutput[mIndex]!=0)
|
||||
mIndex++;
|
||||
|
||||
// End of output. Exit
|
||||
if (mIndex>=mOutput.length())
|
||||
return "";
|
||||
// Skip ONE enter sequence (CRLF, CR, LF, etc.)
|
||||
if ((mOutput[mIndex] == 13) && (mOutput[mIndex] == 10)) // DOS
|
||||
if ((mOutput[mIndex] == '\r') && (mOutput[mIndex] == '\n')) // DOS
|
||||
mIndex+=2;
|
||||
else if (mOutput[mIndex] == 13) // UNIX
|
||||
else if (mOutput[mIndex] == '\r') // UNIX
|
||||
mIndex++;
|
||||
else if (mOutput[mIndex] == 10) // MAC
|
||||
else if (mOutput[mIndex] == '\n') // MAC
|
||||
mIndex++;
|
||||
// Return next line
|
||||
return getRemainingLine();
|
||||
|
@ -756,7 +756,7 @@ QString DebugReader::getRemainingLine()
|
|||
QString Result;
|
||||
|
||||
// Return part of line still ahead of us
|
||||
while (mIndex<mOutput.length() && mOutput[mIndex]!=13 && mOutput[mIndex]!=10 && mOutput[mIndex]!=0) {
|
||||
while (mIndex<mOutput.length() && mOutput[mIndex]!='\r' && mOutput[mIndex]!='\n' && mOutput[mIndex]!=0) {
|
||||
Result += mOutput[mIndex];
|
||||
mIndex++;
|
||||
}
|
||||
|
@ -920,7 +920,7 @@ void DebugReader::handleLocalOutput()
|
|||
return;
|
||||
}
|
||||
//todo: update local view
|
||||
if (nobreakLine and pMainWindow->txtLocals()->document()->lineCount()>0) {
|
||||
if (nobreakLine && pMainWindow->txtLocals()->document()->lineCount()>0) {
|
||||
emit addLocalWithoutLinebreak(s);
|
||||
} else {
|
||||
emit addLocalWithLinebreak(s);
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <QMessageBox>
|
||||
#include <QVariant>
|
||||
#include <mainwindow.h>
|
||||
#include <iconv.h>
|
||||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
#include "settings.h"
|
||||
|
|
|
@ -376,7 +376,7 @@ void MainWindow::rebuildOpenedFileHisotryMenu()
|
|||
for (QString filename: pSettings->history().openedFiles()) {
|
||||
QAction* action = new QAction();
|
||||
action->setText(filename);
|
||||
connect(action, &QAction::triggered, [=,this](bool checked = false){
|
||||
connect(action, &QAction::triggered, [filename,this](bool checked = false){
|
||||
this->openFile(filename);
|
||||
});
|
||||
mRecentFileActions.append(action);
|
||||
|
|
|
@ -564,12 +564,9 @@ PStatement CppParser::doFindStatementInScope(const QString &name, const QString
|
|||
if (statementMap.isEmpty())
|
||||
return PStatement();
|
||||
|
||||
PStatementList statementList = statementMap.values(name,PStatementList());
|
||||
QList<PStatement> statementList = statementMap.values(name);
|
||||
|
||||
if (!statementList)
|
||||
return PStatement();
|
||||
|
||||
for (PStatement statement: *statementList) {
|
||||
for (PStatement statement: statementList) {
|
||||
if (statement->kind == kind && statement->noNameArgs == noNameArgs) {
|
||||
return statement;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ void CppTokenizer::tokenize(const QStringList &buffer)
|
|||
if (mBuffer.isEmpty())
|
||||
return;
|
||||
mBufferStr = mBuffer[0];
|
||||
int i=1;
|
||||
for (int i=1;i<mBuffer.size();i++) {
|
||||
mBufferStr+='\n';
|
||||
mBufferStr+=mBuffer[i];
|
||||
|
@ -82,7 +81,7 @@ void CppTokenizer::addToken(const QString &sText, int iLine)
|
|||
|
||||
void CppTokenizer::countLines()
|
||||
{
|
||||
while ((*mLineCount != '\0') && (mLineCount < mCurrent)) {
|
||||
while ((*mLineCount != 0) && (mLineCount < mCurrent)) {
|
||||
if (*mLineCount == '\n')
|
||||
mCurrentLine ++;
|
||||
mLineCount++;
|
||||
|
@ -97,7 +96,7 @@ QString CppTokenizer::getArguments()
|
|||
simplifyArgs(result);
|
||||
if ((*mCurrent == '.') || ((*mCurrent == '-') && (*(mCurrent + 1) == '>'))) {
|
||||
// skip '.' and '->'
|
||||
while ( !( *mCurrent == '\0'
|
||||
while ( !( *mCurrent == 0
|
||||
|| *mCurrent == '('
|
||||
|| *mCurrent == ';'
|
||||
|| *mCurrent == '{'
|
||||
|
@ -141,7 +140,7 @@ QString CppTokenizer::getNextToken(bool bSkipParenthesis, bool bSkipArray, bool
|
|||
bool done = false;
|
||||
while (true) {
|
||||
skipToNextToken();
|
||||
if (*mCurrent == '\0')
|
||||
if (*mCurrent == 0)
|
||||
break;
|
||||
if (isPreprocessor()) {
|
||||
countLines();
|
||||
|
@ -172,7 +171,7 @@ QString CppTokenizer::getNextToken(bool bSkipParenthesis, bool bSkipArray, bool
|
|||
done = (result != "");
|
||||
} else {
|
||||
switch((*mCurrent).unicode()) {
|
||||
case '\0':
|
||||
case 0:
|
||||
done = true;
|
||||
break;
|
||||
case '/':
|
||||
|
@ -422,7 +421,7 @@ void CppTokenizer::skipAssignment()
|
|||
|| *mCurrent ==';'
|
||||
|| *mCurrent ==')'
|
||||
|| *mCurrent =='}'
|
||||
|| *mCurrent =='\0')
|
||||
|| *mCurrent ==0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -430,13 +429,13 @@ void CppTokenizer::skipAssignment()
|
|||
void CppTokenizer::skipDoubleQuotes()
|
||||
{
|
||||
mCurrent++;
|
||||
while (!(*mCurrent=='"' || *mCurrent == '\0')) {
|
||||
while (!(*mCurrent=='"' || *mCurrent == 0)) {
|
||||
if (*mCurrent == '\\')
|
||||
mCurrent+=2; // skip escaped char
|
||||
else
|
||||
mCurrent++;
|
||||
}
|
||||
if (*mCurrent!='\0') {
|
||||
if (*mCurrent!=0) {
|
||||
mCurrent++;
|
||||
}
|
||||
}
|
||||
|
@ -444,7 +443,7 @@ void CppTokenizer::skipDoubleQuotes()
|
|||
void CppTokenizer::skipPair(const QChar &cStart, const QChar cEnd, const QSet<QChar>& failChars)
|
||||
{
|
||||
mCurrent++;
|
||||
while (*mCurrent != '\0') {
|
||||
while (*mCurrent != 0) {
|
||||
if ((*mCurrent == '(') && !failChars.contains('(')) {
|
||||
skipPair('(', ')', failChars);
|
||||
} else if ((*mCurrent == '[') && !failChars.contains('[')) {
|
||||
|
@ -493,25 +492,25 @@ void CppTokenizer::skipRawString()
|
|||
noEscape = false;
|
||||
break;
|
||||
}
|
||||
if (*mCurrent == '\0')
|
||||
if (*mCurrent == 0)
|
||||
break;
|
||||
if ((*mCurrent == '"') && !noEscape)
|
||||
break;
|
||||
}
|
||||
if (*mCurrent!='\0')
|
||||
if (*mCurrent!=0)
|
||||
mCurrent++;
|
||||
}
|
||||
|
||||
void CppTokenizer::skipSingleQuote()
|
||||
{
|
||||
mCurrent++;
|
||||
while (!(*mCurrent=='\'' || *mCurrent == '\0')) {
|
||||
while (!(*mCurrent=='\'' || *mCurrent == 0)) {
|
||||
if (*mCurrent == '\\')
|
||||
mCurrent+=2; // skip escaped char
|
||||
else
|
||||
mCurrent++;
|
||||
}
|
||||
if (*mCurrent!='\0') {
|
||||
if (*mCurrent!=0) {
|
||||
mCurrent++;
|
||||
}
|
||||
}
|
||||
|
@ -543,10 +542,10 @@ void CppTokenizer::skipTemplateArgs()
|
|||
void CppTokenizer::skipToEOL()
|
||||
{
|
||||
while (true) {
|
||||
while (!isLineChar(*mCurrent) && (*mCurrent!='\0')) {
|
||||
while (!isLineChar(*mCurrent) && (*mCurrent!=0)) {
|
||||
mCurrent++;
|
||||
}
|
||||
if (*mCurrent=='\0')
|
||||
if (*mCurrent==0)
|
||||
return;
|
||||
|
||||
bool splitLine = (*(mCurrent - 1) == '\\');
|
||||
|
@ -554,7 +553,7 @@ void CppTokenizer::skipToEOL()
|
|||
while (isLineChar(*mCurrent))
|
||||
mCurrent++;
|
||||
|
||||
if (!splitLine || *mCurrent=='\0')
|
||||
if (!splitLine || *mCurrent==0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -272,6 +272,7 @@ QString getHeaderFileName(const QString &relativeTo, const QString &line,
|
|||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QString getLocalHeaderFileName(const QString &relativeTo, const QString &fileName)
|
||||
|
|
|
@ -453,7 +453,7 @@ BufferCoord SynEdit::getMatchingBracketEx(BufferCoord APoint)
|
|||
if (Test == Brackets[i]) {
|
||||
// this is the bracket, get the matching one and the direction
|
||||
BracketInc = Brackets[i];
|
||||
BracketDec = Brackets[i xor 1]; // 0 -> 1, 1 -> 0, ...
|
||||
BracketDec = Brackets[i ^ 1]; // 0 -> 1, 1 -> 0, ...
|
||||
// search for the matching bracket (that is until NumBrackets = 0)
|
||||
NumBrackets = 1;
|
||||
if (i%2==1) {
|
||||
|
@ -602,16 +602,16 @@ DisplayCoord SynEdit::pixelsToNearestRowColumn(int aX, int aY) const
|
|||
aY = 0;
|
||||
}
|
||||
return {
|
||||
.Column = std::max(1, (int)(leftChar() + round(f))),
|
||||
.Row = std::max(1, mTopLine + (aY / mTextHeight))
|
||||
std::max(1, (int)(leftChar() + round(f))),
|
||||
std::max(1, mTopLine + (aY / mTextHeight))
|
||||
};
|
||||
}
|
||||
|
||||
DisplayCoord SynEdit::pixelsToRowColumn(int aX, int aY) const
|
||||
{
|
||||
return {
|
||||
.Column = std::max(1, mLeftChar + ((aX - mGutterWidth - 2) / mCharWidth)),
|
||||
.Row = std::max(1, mTopLine + (aY / mTextHeight))
|
||||
std::max(1, mLeftChar + ((aX - mGutterWidth - 2) / mCharWidth)),
|
||||
std::max(1, mTopLine + (aY / mTextHeight))
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1223,7 +1223,7 @@ BufferCoord SynEdit::PrevWordPosEx(const BufferCoord &XY)
|
|||
int CX = XY.Char;
|
||||
int CY = XY.Line;
|
||||
// valid line?
|
||||
if ((CY >= 1) and (CY <= mLines->count())) {
|
||||
if ((CY >= 1) && (CY <= mLines->count())) {
|
||||
QString Line = mLines->getString(CY - 1);
|
||||
CX = std::min(CX, Line.length());
|
||||
if (CX <= 1) {
|
||||
|
|
|
@ -100,6 +100,7 @@ QString SynEditStringList::lineBreak()
|
|||
case FileEndingType::Mac:
|
||||
return "\r";
|
||||
}
|
||||
return "\n";
|
||||
}
|
||||
|
||||
SynRangeState SynEditStringList::ranges(int Index)
|
||||
|
|
|
@ -307,7 +307,7 @@ void SynEditTextPainter::ComputeSelectionInfo()
|
|||
// intersection with the area to be painted.
|
||||
if (bAnySelection) {
|
||||
// Don't care if the selection is not visible.
|
||||
bAnySelection = (vEnd.Line >= vFirstLine) and (vStart.Line <= vLastLine);
|
||||
bAnySelection = (vEnd.Line >= vFirstLine) && (vStart.Line <= vLastLine);
|
||||
if (bAnySelection) {
|
||||
// Transform the selection from text space into screen space
|
||||
vSelStart = edit->bufferToDisplayPos(vStart);
|
||||
|
@ -448,7 +448,7 @@ void SynEditTextPainter::PaintHighlightToken(bool bFillToEOL)
|
|||
bU1 = (nC1 < nLineSelStart);
|
||||
bSel = (nC1 < nLineSelEnd) && (nC2 >= nLineSelStart);
|
||||
bU2 = (nC2 >= nLineSelEnd);
|
||||
bComplexToken = bSel && (bU1 or bU2);
|
||||
bComplexToken = bSel && (bU1 || bU2);
|
||||
} else {
|
||||
bSel = bLineSelected;
|
||||
bComplexToken = false;
|
||||
|
|
|
@ -74,7 +74,7 @@ void SynEditASMHighlighter::CRProc()
|
|||
{
|
||||
mTokenID = TokenKind::Space;
|
||||
mRun++;
|
||||
if (mLine[mRun] == 10)
|
||||
if (mLine[mRun] == '\n')
|
||||
mRun++;
|
||||
}
|
||||
|
||||
|
@ -283,10 +283,10 @@ void SynEditASMHighlighter::next()
|
|||
case 0:
|
||||
NullProc();
|
||||
break;
|
||||
case 10:
|
||||
case '\n':
|
||||
LFProc();
|
||||
break;
|
||||
case 13:
|
||||
case '\r':
|
||||
CRProc();
|
||||
break;
|
||||
case '\"':
|
||||
|
|
|
@ -307,7 +307,7 @@ void SynEditCppHighlighter::ansiCProc()
|
|||
} else if (mRange.state == RangeState::rsAnsiCAsmBlock){
|
||||
mRange.state = RangeState::rsAsmBlock;
|
||||
} else if (mRange.state == RangeState::rsDirectiveComment &&
|
||||
mLine[mRun] != 0 && mLine[mRun]!=13 && mLine[mRun]!=10) {
|
||||
mLine[mRun] != 0 && mLine[mRun]!='\r' && mLine[mRun]!='\n') {
|
||||
mRange.state = RangeState::rsMultiLineDirective;
|
||||
} else {
|
||||
mRange.state = RangeState::rsUnknown;
|
||||
|
@ -680,7 +680,7 @@ void SynEditCppHighlighter::numberProc()
|
|||
case 'e':
|
||||
case 'E':
|
||||
if (mTokenId!=TokenKind::Hex) {
|
||||
if (mLine[mRun-1]>='0' || mLine[mRun-1]<=9 ) {//exponent
|
||||
if (mLine[mRun-1]>='0' || mLine[mRun-1]<='9' ) {//exponent
|
||||
for (int i=idx1;i<mRun;i++) {
|
||||
if (mLine[i] == 'e' || mLine[i]=='E') { // too many exponents
|
||||
mRun+=1;
|
||||
|
@ -820,7 +820,7 @@ void SynEditCppHighlighter::pointProc()
|
|||
if (mLine[mRun+1] == '.' && mLine[mRun+2] == '.') {
|
||||
mRun+=3;
|
||||
mExtTokenId = ExtTokenKind::Ellipse;
|
||||
} else if (mLine[mRun+1]>=0 && mLine[mRun+1]<=9) {
|
||||
} else if (mLine[mRun+1]>=0 && mLine[mRun+1]<='9') {
|
||||
numberProc();
|
||||
} else {
|
||||
mRun+=1;
|
||||
|
|
|
@ -20,7 +20,7 @@ EnvironmentAppearenceWidget::EnvironmentAppearenceWidget(const QString& name, co
|
|||
ui->cbTheme->addItem(name);
|
||||
}
|
||||
ui->cbLanguage->addItem("English","en");
|
||||
ui->cbLanguage->addItem("简体中文","zh_CN");
|
||||
ui->cbLanguage->addItem(tr("Simplified Chinese"),"zh_CN");
|
||||
}
|
||||
|
||||
EnvironmentAppearenceWidget::~EnvironmentAppearenceWidget()
|
||||
|
|
|
@ -115,7 +115,7 @@ QByteArray runAndGetOutput(const QString &cmd, const QString& workingDir, const
|
|||
|
||||
bool isNonPrintableAsciiChar(char ch)
|
||||
{
|
||||
return (ch<=32) and (ch>=0);
|
||||
return (ch<=32) && (ch>=0);
|
||||
}
|
||||
|
||||
bool fileExists(const QString &file)
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
#include <QStringList>
|
||||
|
||||
class QByteArray;
|
||||
class QString;
|
||||
class QStringList;
|
||||
class QTextStream;
|
||||
class QTextCodec;
|
||||
|
||||
|
|
|
@ -252,8 +252,8 @@ void QConsole::paintRows(QPainter &painter, int row1, int row2)
|
|||
RowColumn selBeginRC = mContents.lineCharToRowColumn(selectionBegin());
|
||||
RowColumn selEndRC = mContents.lineCharToRowColumn(selectionEnd());
|
||||
LineChar editBegin = {
|
||||
.ch = mContents.getLastLine().length() - mCurrentEditableLine.length(),
|
||||
.line = mContents.lines()-1
|
||||
mContents.getLastLine().length() - mCurrentEditableLine.length(),
|
||||
mContents.lines()-1
|
||||
};
|
||||
RowColumn editBeginRC = mContents.lineCharToRowColumn(editBegin);
|
||||
bool isSelection = false;
|
||||
|
@ -836,8 +836,8 @@ RowColumn QConsole::pixelsToNearestRowColumn(int x, int y)
|
|||
y = 0;
|
||||
}
|
||||
return {
|
||||
.column = std::max(0, (x - 2) / mColumnWidth),
|
||||
.row = mTopRow + (y / mRowHeight)-1
|
||||
std::max(0, (x - 2) / mColumnWidth),
|
||||
mTopRow + (y / mRowHeight)-1
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue