Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions TextEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2232,7 +2232,7 @@ void TextEditor::ColorizeRange(int aFromLine, int aToLine)
hasTokenizeResult = true;
}

if (hasTokenizeResult == false)
if (!hasTokenizeResult)
{
// todo : remove
//printf("using regex for %.*s\n", first + 10 < last ? 10 : int(last - first), first);
Expand All @@ -2252,7 +2252,7 @@ void TextEditor::ColorizeRange(int aFromLine, int aToLine)
}
}

if (hasTokenizeResult == false)
if (!hasTokenizeResult)
{
first++;
}
Expand Down Expand Up @@ -2376,13 +2376,15 @@ void TextEditor::ColorizeInternal()
auto& startStr = mLanguageDefinition.mCommentStart;
auto& singleStartStr = mLanguageDefinition.mSingleLineComment;

if (!withinSingleLineComment && currentIndex + startStr.size() <= line.size() &&
if (!withinSingleLineComment &&
!startStr.empty() &&
currentIndex + startStr.size() <= line.size() &&
equals(startStr.begin(), startStr.end(), from, from + startStr.size(), pred))
{
commentStartLine = currentLine;
commentStartIndex = currentIndex;
}
else if (singleStartStr.size() > 0 &&
else if (!singleStartStr.empty() &&
currentIndex + singleStartStr.size() <= line.size() &&
equals(singleStartStr.begin(), singleStartStr.end(), from, from + singleStartStr.size(), pred))
{
Expand All @@ -2395,7 +2397,8 @@ void TextEditor::ColorizeInternal()
line[currentIndex].mComment = withinSingleLineComment;

auto& endStr = mLanguageDefinition.mCommentEnd;
if (currentIndex + 1 >= (int)endStr.size() &&
if (!endStr.empty() &&
currentIndex + 1 >= (int)endStr.size() &&
equals(endStr.begin(), endStr.end(), from + 1 - endStr.size(), from + 1, pred))
{
commentStartIndex = endIndex;
Expand Down Expand Up @@ -2660,7 +2663,7 @@ static bool TokenizeCStyleNumber(const char * in_begin, const char * in_end, con
p++;
}

if (hasNumber == false)
if (!hasNumber)
return false;

bool isFloat = false;
Expand Down Expand Up @@ -2702,7 +2705,7 @@ static bool TokenizeCStyleNumber(const char * in_begin, const char * in_end, con
}
}

if (isHex == false && isBinary == false)
if (!isHex && !isBinary)
{
// floating point exponent
if (p < in_end && (*p == 'e' || *p == 'E'))
Expand All @@ -2723,7 +2726,7 @@ static bool TokenizeCStyleNumber(const char * in_begin, const char * in_end, con
p++;
}

if (hasDigits == false)
if (!hasDigits)
return false;
}

Expand All @@ -2732,7 +2735,7 @@ static bool TokenizeCStyleNumber(const char * in_begin, const char * in_end, con
p++;
}

if (isFloat == false)
if (!isFloat)
{
// integer size type
while (p < in_end && (*p == 'u' || *p == 'U' || *p == 'l' || *p == 'L'))
Expand Down