From e8a1603f809138b645694f9280cd9eff26b6dfed Mon Sep 17 00:00:00 2001 From: Nigel Date: Sun, 9 Aug 2026 16:44:25 +0100 Subject: [PATCH] Improve edge case for WF Hyphen search Find "school teacher" in "Sunday-school teacher" when clicking on WF hyphens report. Fixes #1922 --- src/guiguts/word_frequency.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/guiguts/word_frequency.py b/src/guiguts/word_frequency.py index 11563201..26dfe6f9 100644 --- a/src/guiguts/word_frequency.py +++ b/src/guiguts/word_frequency.py @@ -785,14 +785,18 @@ def goto_word( # Also, boundary for an emdash is any non-emdash, but for other non-word characters the # boundary is a word/space character emdash_bound = "—" if newline_word[0] == "—" else r"[^\w\s]" + # If word contains space, then permit boundary character to be a hyphen + # (by not having it in the excluded characters) + # e.g. "school teacher" will match "Sunday-school teacher" + hyph_bound = "" if " " in newline_word else "-" left_boundary = ( - r"(?