--- src/search.c +++ src/search.c @@ -641,7 +641,8 @@ break; if (try + len < buf + size && WCHAR((unsigned char) try[len])) { - offset = kwsexec (kwset, beg, --len, &kwsmatch); + ++beg; + offset = kwsexec (kwset, beg, buf + size - beg, &kwsmatch); if (offset == (size_t) -1) { #ifdef MBS_SUPPORT