- fix: correctly handle integer with 'L' suffix in #if directives ( so <thread> can be correctly parsed )

- fix: correctly fill indents if it's not multiples of tab width
This commit is contained in:
royqh1979 2021-10-20 20:15:16 +08:00
parent e51473fdde
commit a5acb077fc
3 changed files with 28 additions and 5 deletions

View File

@ -6,6 +6,7 @@ Version 0.7.0
- fix: when an editor is created, its caret will be displayed even it doesn't have focus - fix: when an editor is created, its caret will be displayed even it doesn't have focus
- enhancement: set mouse wheel scroll speed in the editor general option tab ( 3 lines by default) - enhancement: set mouse wheel scroll speed in the editor general option tab ( 3 lines by default)
- fix: don't highlight '#' with spaces preceeding it as error - fix: don't highlight '#' with spaces preceeding it as error
- fix: correctly handle integer with 'L' suffix in #if directives ( so <thread> can be correctly parsed )
Version 0.6.8 Version 0.6.8
- enhancement: add link to cppreference in the help menu - enhancement: add link to cppreference in the help menu

View File

@ -1317,7 +1317,25 @@ bool CppPreprocessor::evalNumber(const QString &expr, int &result, int &pos)
pos++; pos++;
} }
bool ok; bool ok;
result = s.toInt(&ok,0);
if (s.endsWith("LL",Qt::CaseInsensitive)) {
s.remove(s.length()-2,2);
result = s.toLongLong(&ok,0);
} else if (s.endsWith("L",Qt::CaseInsensitive)) {
s.remove(s.length()-1,1);
result = s.toLong(&ok,0);
} else if (s.endsWith("ULL",Qt::CaseInsensitive)) {
s.remove(s.length()-3,3);
result = s.toULongLong(&ok,0);
} else if (s.endsWith("UL",Qt::CaseInsensitive)) {
s.remove(s.length()-2,2);
result = s.toULong(&ok,0);
} else if (s.endsWith("U",Qt::CaseInsensitive)) {
s.remove(s.length()-1,1);
result = s.toUInt(&ok,0);
} else {
result = s.toInt(&ok,0);
}
return ok; return ok;
} }

View File

@ -708,13 +708,17 @@ void SynEditTextPainter::PaintFoldAttributes()
} }
} }
if (edit->mCodeFolding.fillIndents) { if (edit->mCodeFolding.fillIndents) {
int X1=TabSteps * edit->mCharWidth + edit->textOffset() - 2; int X1;
if (TabSteps>LineIndent)
X1 = LineIndent * edit->mCharWidth + edit->textOffset() - 2;
else
X1 = TabSteps * edit->mCharWidth + edit->textOffset() - 2;
gradientStart.setAlpha(20); gradientStart.setAlpha(20);
gradientEnd.setAlpha(10); gradientEnd.setAlpha(10);
QLinearGradient gradient(X,Y,X1,Y); QLinearGradient gradient(X,Y,X1,Y);
gradient.setColorAt(0,gradientStart); gradient.setColorAt(1,gradientStart);
gradient.setColorAt(1,gradientEnd); gradient.setColorAt(0,gradientEnd);
painter->fillRect(X,Y,edit->mTabWidth * edit->mCharWidth,edit->mTextHeight,gradient); painter->fillRect(X,Y,(X1-X),edit->mTextHeight,gradient);
} }
// Move to top of vertical line // Move to top of vertical line