Don't set word_characters to select_by_word_characters when empty string

This allows you to pass in --word-characters "" which will make hints
only match \w.
This commit is contained in:
Trygve Aaberge 2020-04-13 23:02:44 +02:00
parent 0196920533
commit 681fe7f2f2

View File

@ -315,7 +315,7 @@ def functions_for(args: HintsCLIOptions) -> Tuple[str, List[PostprocessorFunc]]:
pattern = '[0-9a-f]{7,128}' pattern = '[0-9a-f]{7,128}'
elif args.type == 'word': elif args.type == 'word':
chars = args.word_characters chars = args.word_characters
if not chars: if chars is None:
chars = kitty_common_opts()['select_by_word_characters'] chars = kitty_common_opts()['select_by_word_characters']
pattern = r'(?u)[{}\w]{{{},}}'.format(escape(chars), args.minimum_match_length) pattern = r'(?u)[{}\w]{{{},}}'.format(escape(chars), args.minimum_match_length)
post_processors.extend((brackets, quotes)) post_processors.extend((brackets, quotes))