Skip to content

Commit 7fc39f0

Browse files
committed
Fix prefix highlit in text search
1 parent bf83364 commit 7fc39f0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tools/xsrc.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#define XSEARCH_VERSION_MAX 1
1717
#define XSEARCH_VERSION_MIN 0
18-
#define XSEARCH_BUILD_NUMBER 14
18+
#define XSEARCH_BUILD_NUMBER 15
1919

2020
#define XSEARCH_MAX_READ_SIZE 1024 * 1024 * 1024
2121
#define XSEARCH_INFO_LEN 128
@@ -389,7 +389,7 @@ static void XSearch_ColorizeLine(char *pDst, size_t nSize, xfile_entry_t *pEntry
389389
xstrnclr(sColorized, sizeof(sColorized), XSTR_CLR_RED, "%s", pText);
390390
xstrncatf(pDst, XSTR_NAVAIL(pDst, nSize), "%s", XSTR_FMT_DIM);
391391

392-
if ((!bHasSpace || bJumpSpace) && xstrcmp(pLine, pText))
392+
if ((!bHasSpace || bJumpSpace) && xstrncmp(pLine, pText, strlen(pText)))
393393
xstrncatf(pDst, XSTR_NAVAIL(pDst, nSize), "%s%s", sColorized, XSTR_FMT_DIM);
394394

395395
for (i = 0; i < pArr->nUsed; i++)
@@ -424,7 +424,8 @@ static void XSearch_DisplayEntry(xfile_search_t *pSearch, xfile_entry_t *pEntry)
424424
if (!((xsearch_args_t*)pSearch->pUserCtx)->bVerbose)
425425
{
426426
if (pEntry->nLineNum && xstrused(sLine))
427-
xlog("%s:%s%d%s %s", sEntry, XSTR_FMT_BOLD, pEntry->nLineNum, XSTR_FMT_RESET, sLine);
427+
xlog("%s:%s%d%s %s", sEntry, XSTR_FMT_BOLD,
428+
pEntry->nLineNum, XSTR_FMT_RESET, sLine);
428429
else if (xstrused(sLine)) xlog("%s: %s", sEntry, sLine);
429430
else xlog("%s%s%s", sEntry, pArrow, sLinkPath);
430431

0 commit comments

Comments
 (0)