Skip to content

Commit

Permalink
Improve mark occurrences by using case sensitive match for ASCII text…
Browse files Browse the repository at this point in the history
… without letters, issue #236.
  • Loading branch information
zufuliu committed Oct 13, 2020
1 parent 22c42e2 commit 3455e3b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Edit.c
Original file line number Diff line number Diff line change
Expand Up @@ -5629,6 +5629,21 @@ void EditMarkAll_ClearEx(int findFlag, Sci_Position iSelCount, LPCSTR pszText) {
}

BOOL EditMarkAll_Start(BOOL bChanged, int findFlag, Sci_Position iSelCount, LPCSTR pszText) {
// use case sensitive match for ASCII text without letters.
if (!(findFlag & (SCFIND_REGEXP | SCFIND_MATCHCASE))) {
int sensitive = SCFIND_MATCHCASE;
const uint8_t *ptr = (const uint8_t *)pszText;
uint8_t ch;
while ((ch = *ptr++) != 0) {
ch |= 0x20;
if ((ch & 0x80) != 0 || (ch >= 'a' && ch <= 'z')) {
sensitive = 0;
break;
}
}
findFlag |= sensitive;
}

if (!bChanged && (findFlag == editMarkAllStatus.findFlag
&& iSelCount == editMarkAllStatus.iSelCount
// _stricmp() is not safe for DBCS string.
Expand Down

0 comments on commit 3455e3b

Please sign in to comment.