Skip to content

Commit f05333a

Browse files
committed
Fix rewrite to not write past the edge of the screen
1 parent 2455f86 commit f05333a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

_pytest/terminal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def rewrite(self, line, **markup):
214214
"""
215215
erase = markup.pop('erase', False)
216216
if erase:
217-
fill_count = self.writer.fullwidth - len(line)
217+
fill_count = self.writer.fullwidth - len(line) - 1
218218
fill = ' ' * fill_count
219219
else:
220220
fill = ''

testing/test_terminal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def test_rewrite(self, testdir, monkeypatch):
222222
tr.writer.fullwidth = 10
223223
tr.write('hello')
224224
tr.rewrite('hey', erase=True)
225-
assert f.getvalue() == 'hello' + '\r' + 'hey' + (7 * ' ')
225+
assert f.getvalue() == 'hello' + '\r' + 'hey' + (6 * ' ')
226226

227227

228228
class TestCollectonly(object):

0 commit comments

Comments
 (0)