Skip to content

Commit 78225c7

Browse files
tobiasbrunnerlucasdemarchi
authored andcommitted
Allow words with different case on one line, but ask the user only once.
1 parent 1ac62ef commit 78225c7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

codespell.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,28 +298,30 @@ def parse_file(filename, colors, summary):
298298
continue
299299

300300
fixed_words = set()
301+
asked_for = set()
301302

302303
for word in rx.findall(line):
303304
lword = word.lower()
304305
if lword in misspellings:
305306
fix = misspellings[lword].fix
306307
fixword = fix_case(word, misspellings[lword].data)
307308

308-
if options.interactive and not lword in fixed_words:
309+
if options.interactive and not lword in asked_for:
309310
fix, fixword = ask_for_word_fix(lines[i - 1], word,
310311
misspellings[lword],
311312
options.interactive)
313+
asked_for.add(lword)
312314

313315
if summary and fix:
314316
summary.update(lword)
315317

316-
if lword in fixed_words:
318+
if word in fixed_words:
317319
continue
318320

319321
if options.write_changes and fix:
320322
changed = True
321323
lines[i - 1] = re.sub(r'\b%s\b' % word, fixword, lines[i - 1])
322-
fixed_words.add(lword)
324+
fixed_words.add(word)
323325
continue
324326

325327
# otherwise warning was explicitly set by interactive mode

0 commit comments

Comments
 (0)