You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Work diff canvas splits hunk lines at form feeds and Unicode line separators #281
parse_unified_diff (server/unified_diff.py) should treat each patch line as Git emitted it. It iterates over source.splitlines(), and str.splitlines() breaks not only at \n but also at form feed (\f), vertical tab, \x1c–\x1e, \x85, U+2028 and U+2029. Such characters inside a source line split that line in two:
the rest of the line becomes a separate patch line; if it starts with -, + or a space, it is rendered as a phantom removed/added/context line, and the additions/deletions counts and every following line number are wrong;
otherwise the rest is silently dropped, so the shown line is truncated.
Form feeds are common page separators in Python, C and Lisp sources, and U+2028 appears in JavaScript/JSON strings.
Steps to reproduce / 复现步骤
In a Git repository, commit app.py containing:
def a():
pass
<form feed>
def b():
pass
Change it to return 1 in a() and replace the last line with x = "a<form feed>-b", then run:
Git terminates patch lines with \n only. Splitting on \n and removing a trailing \r keeps the current handling of CRLF content and CRLF-framed patches.
Related issues or fixes / 相关问题或修复
#274 / #275 fixed a different parser defect in the same function.
Activity
fix(work): preserve line framing throughout attempt diffs (Code-Amade…