From d15905c918eb4431d2a97b882cb0364c1226ebc1 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 4 Mar 2026 09:20:53 +0530 Subject: [PATCH] Change default word regexp to exclude punctuation --- kittens/diff/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kittens/diff/main.py b/kittens/diff/main.py index 8b767e53f..cc1a1c4ab 100644 --- a/kittens/diff/main.py +++ b/kittens/diff/main.py @@ -76,11 +76,11 @@ only applies when a changed chunk has equal numbers of added and removed lines. ''' ) -opt('word_regex', r'\S+', +opt('word_regex', r'[^\s\p{P}]+', long_text=''' The regular expression used to define a word when :opt:`word_diff_mode` is -:code:`words`. The default value of :code:`\\S+` matches any run of -non-whitespace characters. The expression must be a valid Go regular expression. +:code:`words`. The default value matches any run of non-whitespace and +non-punctuation characters. The expression must be a valid Go regular expression. If an invalid expression is provided, diff will fail with an error. ''' )