summaryrefslogtreecommitdiff
path: root/src/grep.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/grep.c')
-rw-r--r--src/grep.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/grep.c b/src/grep.c
index d8ea70fc..0ca0d9ad 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -2563,9 +2563,12 @@ main (int argc, char **argv)
/* If fgrep in a multibyte locale, then use grep if either
(1) case is ignored (where grep is typically faster), or
- (2) the pattern has an encoding error (where fgrep might not work). */
- if (compile == Fcompile && MB_CUR_MAX > 1
- && (match_icase || contains_encoding_error (keys, keycc)))
+ (2) the pattern matches words (where grep is typically faster), or
+ (3) the pattern has an encoding error (where fgrep might not work). */
+ if (compile == Fcompile
+ && (MB_CUR_MAX > 1 && (match_icase
+ || contains_encoding_error (keys, keycc)))
+ || (MB_CUR_MAX == 1 && match_words))
{
size_t new_keycc;
char *new_keys;