Fix Search result line number highlighting inaccurate issue

This commit is contained in:
Don HO 2020-12-09 03:34:18 +01:00
parent e3455a0f7e
commit 2f6454a085
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
2 changed files with 8 additions and 8 deletions

View File

@ -1364,7 +1364,7 @@
<LexerType name="searchResult" desc="Search result" ext="">
<WordsStyle name="Search Header" styleID="1" fgColor="000080" bgColor="BBBBFF" fontName="" fontStyle="1" fontSize="" />
<WordsStyle name="File Header" styleID="2" fgColor="008000" bgColor="D5FFD5" fontName="" fontStyle="1" fontSize="" />
<WordsStyle name="Line Number" styleID="3" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
<WordsStyle name="Line Number" styleID="3" fgColor="FF8040" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
<WordsStyle name="Hit Word" styleID="4" fgColor="FF0000" bgColor="FFFFBF" fontName="" fontStyle="0" fontSize="" />
<WordsStyle name="Selected Line" styleID="5" fgColor="000080" bgColor="FFFF4F" fontName="" fontStyle="0" fontSize="" />
<WordsStyle name="Current line background colour" styleID="6" bgColor="E8E8FF" />

View File

@ -62,15 +62,15 @@ static void ColouriseSearchResultLine(SearchResultMarkings* pMarkings, char *lin
}
else if (lineBuffer[0] == ' ')// \t - line info
{
const unsigned int firstTokenLen = 4;
unsigned int currentPos;
unsigned int firstTokenLen = 0;
unsigned int currentPos = 0;
styler.ColourTo(startLine + firstTokenLen, SCE_SEARCHRESULT_DEFAULT);
for (currentPos = firstTokenLen; lineBuffer[currentPos] != ':'; currentPos++)
{
// Just make currentPos mover forward
}
for (; !(lineBuffer[firstTokenLen] >= '0' && lineBuffer[firstTokenLen] <= '9'); firstTokenLen++);
styler.ColourTo(startLine + firstTokenLen - 1, SCE_SEARCHRESULT_DEFAULT);
for (currentPos = firstTokenLen; lineBuffer[currentPos] != ':'; currentPos++);
styler.ColourTo(startLine + currentPos - 1, SCE_SEARCHRESULT_LINE_NUMBER);