1
0
Fork 0

Rewind tmpfile and skip empty lines

master
LEdoian 5 years ago
parent 40a4e3ea11
commit 7c02d2c1da

@ -139,8 +139,12 @@ def user_action(hunk: Sequence[Command], context=None) -> Sequence[Command]:
import subprocess import subprocess
subprocess.run([editor, tmpfile.name]) subprocess.run([editor, tmpfile.name])
# Read the file back # Read the file back
tmpfile.file.seek(0)
new_hunk = [] new_hunk = []
for line in tmpfile.file.readlines(): for line in tmpfile.file.readlines():
line = line.strip()
if line == '':
continue
parts = line.split('\t', maxsplit=2) parts = line.split('\t', maxsplit=2)
new_hunk.append(Command(user=parts[0],directory=parts[1],command=parts[2],context=None)) new_hunk.append(Command(user=parts[0],directory=parts[1],command=parts[2],context=None))
# Python has no goto for restarting, but we can recurse # Python has no goto for restarting, but we can recurse

Loading…
Cancel
Save