mirror of
https://github.com/codespell-project/codespell.git
synced 2025-05-17 15:36:17 +08:00
Do not override previous fix
If there are two words misspelled in a line, codespell was detecting both, but when writing them to file only the latest was actually being fixed. This is because we used the wrong line string to fix them.
This commit is contained in:
@ -178,7 +178,7 @@ def parse_file(filename, colors):
|
||||
|
||||
if options.write_changes and misspellings[lword].fix:
|
||||
changed = True
|
||||
lines[i - 1] = line.replace(word, fixword, 1)
|
||||
lines[i - 1] = lines[i - 1].replace(word, fixword, 1)
|
||||
continue
|
||||
|
||||
cfilename = "%s%s%s" % (colors.FILE, filename, colors.DISABLE)
|
||||
|
Reference in New Issue
Block a user