mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
refactor: rewrite the way reading full message of commit
This commit is contained in:
parent
a99bd2e973
commit
751991c816
2 changed files with 11 additions and 8 deletions
|
@ -52,28 +52,31 @@ namespace SourceGit.Commands
|
|||
_current.Commit.CommitterTime = ulong.Parse(line);
|
||||
break;
|
||||
default:
|
||||
if (line.Equals(_boundary, StringComparison.Ordinal))
|
||||
var boundary = rs.StdOut.IndexOf(_boundary, end + 1);
|
||||
if (boundary > end)
|
||||
{
|
||||
nextPartIdx = -1;
|
||||
_current.Message = _current.Message.Trim();
|
||||
_current.Message = rs.StdOut.Substring(start, boundary - start - 1);
|
||||
end = boundary + _boundary.Length;
|
||||
}
|
||||
else
|
||||
{
|
||||
_current.Message = _current.Message + "\n" + line;
|
||||
_current.Message = rs.StdOut.Substring(start);
|
||||
end = rs.StdOut.Length - 2;
|
||||
}
|
||||
|
||||
nextPartIdx = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
nextPartIdx++;
|
||||
|
||||
start = end + 1;
|
||||
if (start >= rs.StdOut.Length - 1)
|
||||
break;
|
||||
|
||||
end = rs.StdOut.IndexOf('\n', start);
|
||||
}
|
||||
|
||||
if (_current != null)
|
||||
_current.Message = _current.Message.Trim();
|
||||
|
||||
return _commits;
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ namespace SourceGit.Views
|
|||
if (change.Property == TextProperty && _changingWay == TextChangeWay.None)
|
||||
{
|
||||
_changingWay = TextChangeWay.FromSource;
|
||||
var normalized = Text.ReplaceLineEndings("\n").Trim();
|
||||
var normalized = Text.ReplaceLineEndings("\n");
|
||||
var subjectEnd = normalized.IndexOf("\n\n", StringComparison.Ordinal);
|
||||
if (subjectEnd == -1)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue