Fix replacement of same word in one line

When one line had the same mispelled word, codespell was incorrectly
fixing that line, even introducing new typos. This was because the list
of misspelled words were not updated according the fixes.

Instead of always updating this list and making the loop more difficult,
we do as following:

- Cache the words that are fixed in a certain line
- Fix all cases of a misspelled in each line (this means that
  interactive mode will fix all cases with the same suggestions... not
  awesome, but simplifies a lot the code)
- Use a regex with re.sub() instead of the naive string.replace()
  function. This eliminates dumb cases of matching partial words and
  modifying them. Eg.: addres->address would modify addressable to
  addresssable.
- Skip words that were already fixed by previous iteration.

Thanks to Bruce Cran <bruce@cran.org.uk> for reporting this issue.
1 file changed
tree: a07e9c3189b0eac537b9c351b0058405d047c436
  1. data/
  2. example/
  3. codespell.py
  4. COPYING
  5. README