Merge pull request #839 from gimoh/patch-1
Do not insert extra newline if line already contains it
This commit is contained in:
commit
13116d8ac0
1 changed files with 5 additions and 2 deletions
|
@ -245,8 +245,11 @@ def present(module, dest, regexp, line, insertafter, insertbefore, create,
|
||||||
# Don't do backref expansion if not asked.
|
# Don't do backref expansion if not asked.
|
||||||
new_line = line
|
new_line = line
|
||||||
|
|
||||||
if lines[index[0]] != new_line + os.linesep:
|
if not new_line.endswith(os.linesep):
|
||||||
lines[index[0]] = new_line + os.linesep
|
new_line += os.linesep
|
||||||
|
|
||||||
|
if lines[index[0]] != new_line:
|
||||||
|
lines[index[0]] = new_line
|
||||||
msg = 'line replaced'
|
msg = 'line replaced'
|
||||||
changed = True
|
changed = True
|
||||||
elif backrefs:
|
elif backrefs:
|
||||||
|
|
Loading…
Reference in a new issue