mirror of
https://github.com/nvbn/thefuck.git
synced 2025-02-23 13:28:39 +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):
|
def _group_by_calls(log):
|
||||||
|
ps1 = os.environ['PS1']
|
||||||
|
ps1_newlines = ps1.count('\\n') + ps1.count('\n')
|
||||||
|
ps1_counter = 0
|
||||||
|
|
||||||
script_line = None
|
script_line = None
|
||||||
lines = []
|
lines = []
|
||||||
for line in log:
|
for line in log:
|
||||||
@ -19,10 +23,16 @@ def _group_by_calls(log):
|
|||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if const.USER_COMMAND_MARK in line:
|
if const.USER_COMMAND_MARK in line or ps1_counter > 0:
|
||||||
if script_line:
|
if script_line and ps1_counter == 0:
|
||||||
yield script_line, lines
|
yield script_line, lines
|
||||||
|
|
||||||
|
if ps1_newlines > 0:
|
||||||
|
if ps1_counter <= 0:
|
||||||
|
ps1_counter = ps1_newlines
|
||||||
|
else:
|
||||||
|
ps1_counter -= 1
|
||||||
|
|
||||||
script_line = line
|
script_line = line
|
||||||
lines = [line]
|
lines = [line]
|
||||||
elif script_line is not None:
|
elif script_line is not None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user