Skip to content

Commit b22e8d5

Browse files
committed
Allow words with different case on one line, but ask the user only once.
1 parent 4e11626 commit b22e8d5

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

codespell.py

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

365365
fixed_words = set()
366+
asked_for = set()
366367

367368
for word in rx.findall(line):
368369
lword = word.lower()
369370
if lword in misspellings:
370371
fix = misspellings[lword].fix
371372
fixword = fix_case(word, misspellings[lword].data)
372373

373-
if options.interactive and not lword in fixed_words:
374+
if options.interactive and not lword in asked_for:
374375
fix, fixword = ask_for_word_fix(lines[i - 1], word,
375376
misspellings[lword],
376377
options.interactive)
378+
asked_for.add(lword)
377379

378380
if summary and fix:
379381
summary.update(lword)
380382

381-
if lword in fixed_words:
383+
if word in fixed_words:
382384
continue
383385

384386
if options.write_changes and fix:
385387
changed = True
386388
lines[i - 1] = re.sub(r'\b%s\b' % word, fixword, lines[i - 1])
387-
fixed_words.add(lword)
389+
fixed_words.add(word)
388390
continue
389391

390392
# otherwise warning was explicitly set by interactive mode

0 commit comments

Comments
 (0)