mirror of
https://github.com/nvbn/thefuck.git
synced 2025-02-21 20:38:54 +00:00
Merge pull request #693 from sQu1rr/master
fixes #692 : multiline PS1 breaking instant mode
This commit is contained in:
commit
e94f420cb1
@ -11,6 +11,10 @@ from .. import const, logs
|
||||
|
||||
|
||||
def _group_by_calls(log):
|
||||
ps1 = os.environ['PS1']
|
||||
ps1_newlines = ps1.count('\\n') + ps1.count('\n')
|
||||
ps1_counter = 0
|
||||
|
||||
script_line = None
|
||||
lines = []
|
||||
for line in log:
|
||||
@ -19,10 +23,16 @@ def _group_by_calls(log):
|
||||
except UnicodeDecodeError:
|
||||
continue
|
||||
|
||||
if const.USER_COMMAND_MARK in line:
|
||||
if script_line:
|
||||
if const.USER_COMMAND_MARK in line or ps1_counter > 0:
|
||||
if script_line and ps1_counter == 0:
|
||||
yield script_line, lines
|
||||
|
||||
if ps1_newlines > 0:
|
||||
if ps1_counter <= 0:
|
||||
ps1_counter = ps1_newlines
|
||||
else:
|
||||
ps1_counter -= 1
|
||||
|
||||
script_line = line
|
||||
lines = [line]
|
||||
elif script_line is not None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user