Skip to content

Commit

Permalink
Allow words with different case on one line, but ask the user only once.
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasbrunner committed Jul 25, 2011
1 parent 4e11626 commit b22e8d5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions codespell.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,28 +363,30 @@ def parse_file(filename, colors, summary):
continue

fixed_words = set()
asked_for = set()

for word in rx.findall(line):
lword = word.lower()
if lword in misspellings:
fix = misspellings[lword].fix
fixword = fix_case(word, misspellings[lword].data)

if options.interactive and not lword in fixed_words:
if options.interactive and not lword in asked_for:
fix, fixword = ask_for_word_fix(lines[i - 1], word,
misspellings[lword],
options.interactive)
asked_for.add(lword)

if summary and fix:
summary.update(lword)

if lword in fixed_words:
if word in fixed_words:
continue

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

# otherwise warning was explicitly set by interactive mode
Expand Down

0 comments on commit b22e8d5

Please sign in to comment.