mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-21 21:30:37 +08:00
fix: gets doubled EOLs while coping content with CRLF line-endings in diff view (#2091)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
@@ -116,21 +116,13 @@ namespace SourceGit.Native
|
||||
static OS()
|
||||
{
|
||||
if (OperatingSystem.IsWindows())
|
||||
{
|
||||
_backend = new Windows();
|
||||
}
|
||||
else if (OperatingSystem.IsMacOS())
|
||||
{
|
||||
_backend = new MacOS();
|
||||
}
|
||||
else if (OperatingSystem.IsLinux())
|
||||
{
|
||||
_backend = new Linux();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new PlatformNotSupportedException();
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetupDataDir()
|
||||
@@ -167,11 +159,7 @@ namespace SourceGit.Native
|
||||
|
||||
public static void SetShellOrTerminal(Models.ShellOrTerminal shell)
|
||||
{
|
||||
if (shell == null)
|
||||
ShellOrTerminal = string.Empty;
|
||||
else
|
||||
ShellOrTerminal = _backend.FindTerminal(shell);
|
||||
|
||||
ShellOrTerminal = shell != null ? _backend.FindTerminal(shell) : string.Empty;
|
||||
ShellOrTerminalArgs = shell.Args;
|
||||
}
|
||||
|
||||
|
||||
@@ -841,15 +841,14 @@ namespace SourceGit.Views
|
||||
// The first selected line (partial selection)
|
||||
if (i == startIdx && startPosition.Column > 1)
|
||||
{
|
||||
builder.Append(line.Content.AsSpan(startPosition.Column - 1));
|
||||
builder.Append(Environment.NewLine);
|
||||
builder.Append(line.Content.AsSpan(startPosition.Column - 1)).Append('\n');
|
||||
continue;
|
||||
}
|
||||
|
||||
// The selection range is larger than original source.
|
||||
if (i == lines.Count - 1 && i < endIdx)
|
||||
{
|
||||
builder.Append(line.Content);
|
||||
builder.Append(line.Content).Append('\n');
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -865,7 +864,7 @@ namespace SourceGit.Views
|
||||
}
|
||||
|
||||
// Other lines.
|
||||
builder.AppendLine(line.Content);
|
||||
builder.Append(line.Content).Append('\n');
|
||||
}
|
||||
|
||||
await App.CopyTextAsync(builder.ToString());
|
||||
|
||||
Reference in New Issue
Block a user