Skip to content

Commit 7a724ef

Browse files
author
Lucas De Marchi
committed
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.
1 parent 3a0c196 commit 7a724ef

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

codespell.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def parse_file(filename, colors):
178178

179179
if options.write_changes and misspellings[lword].fix:
180180
changed = True
181-
lines[i - 1] = line.replace(word, fixword, 1)
181+
lines[i - 1] = lines[i - 1].replace(word, fixword, 1)
182182
continue
183183

184184
cfilename = "%s%s%s" % (colors.FILE, filename, colors.DISABLE)

0 commit comments

Comments
 (0)