Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Report open curly quotes preceded by punctuation #713

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/guiguts/misc_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1910,6 +1910,7 @@ def populate(self) -> None:
search_start = maintext().start()
search_end = maintext().index(tk.END)
last_open_double_idx = ""
punctuation = ".,;:!?"
while match := maintext().find_match(
rf"^$|[{DQUOTES}{SQUOTES}\"']",
IndexRange(search_start, search_end),
Expand Down Expand Up @@ -1950,6 +1951,8 @@ def add_quote_entry(prefix: str) -> None:
add_quote_entry("DOUBLE OPEN QUOTE FOLLOWED BY SPACE: ")
elif context[0].isalnum():
add_quote_entry("DOUBLE OPEN QUOTE PRECEDED BY WORD CHARACTER: ")
elif context[0] in punctuation:
add_quote_entry("DOUBLE OPEN QUOTE PRECEDED BY PUNCTUATION: ")
dqtype = 1
last_open_double_idx = match.rowcol.index()
elif match_text == DQUOTES[1]: # Close double
Expand Down Expand Up @@ -1985,6 +1988,8 @@ def add_quote_entry(prefix: str) -> None:
add_quote_entry("SINGLE OPEN QUOTE FOLLOWED BY SPACE: ")
elif context[0].isalnum():
add_quote_entry("SINGLE OPEN QUOTE PRECEDED BY WORD CHARACTER: ")
elif context[0] in punctuation:
add_quote_entry("SINGLE OPEN QUOTE PRECEDED BY PUNCTUATION: ")
elif match_text == SQUOTES[1]: # Close single
pass # Close singles/apostrophes can go almost anywhere
elif match_text == '"': # Straight double
Expand Down