Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlm committed Jan 9, 2025
1 parent 40cc7ec commit 8aecf8e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 22 deletions.
21 changes: 10 additions & 11 deletions src/Consolonia.PlatformSupport/Clipboard/ClipboardProcessRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,17 @@ public static (int exitCode, string result) Process(
{
var output = string.Empty;

using var process = new Process
using var process = new Process();

process.StartInfo = new()
{
StartInfo = new()
{
FileName = cmd,
Arguments = arguments,
RedirectStandardOutput = true,
RedirectStandardError = true,
RedirectStandardInput = true,
UseShellExecute = false,
CreateNoWindow = true
}
FileName = cmd,
Arguments = arguments,
RedirectStandardOutput = true,
RedirectStandardError = true,
RedirectStandardInput = true,
UseShellExecute = false,
CreateNoWindow = true
};

// TaskCompletionSource<bool> eventHandled = new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Consolonia.PlatformSupport.Clipboard
/// A clipboard implementation for MacOSX. This implementation uses the Mac clipboard API (via P/Invoke) to
/// copy/paste. The existence of the Mac pbcopy and pbpaste commands is used to determine if copy/paste is supported.
/// </summary>
internal class MacOSXClipboard : IClipboard
internal class MacClipboard : IClipboard
{
private readonly nint _allocRegister = sel_registerName("alloc");
private readonly nint _clearContentsRegister = sel_registerName("clearContents");
Expand All @@ -26,7 +26,7 @@ internal class MacOSXClipboard : IClipboard
private readonly nint _utf8Register = sel_registerName("UTF8String");
private readonly nint _utfTextType;

public MacOSXClipboard()
public MacClipboard()
{
_utfTextType = objc_msgSend(
objc_msgSend(_nsString, _allocRegister),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ namespace Consolonia.PlatformSupport.Clipboard
/// to store the data, and uses Windows' powershell.exe (launched via WSL interop services) to set/get the Windows
/// clipboard.
/// </summary>
internal class WSLClipboard : IClipboard
internal class WslClipboard : IClipboard
{
private static string _powershellPath = string.Empty;

private bool _isSupported;
public WSLClipboard()
public WslClipboard()
{
if (string.IsNullOrEmpty(_powershellPath))
{
Expand Down
13 changes: 6 additions & 7 deletions src/Consolonia.PlatformSupport/PlatformSupportExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,16 @@ public static AppBuilder UseAutoDetectedConsole(this AppBuilder builder)

/// <summary>Provides cut, copy, and paste support for the OS clipboard.</summary>
/// <remarks>
/// <para>On Windows, the <see cref="Clipboard"/> class uses the Avalonia Windows Clipboard .</para>
/// <para>On Windows, we use the Avalonia Windows Clipboard .</para>
/// <para>
/// On Linux, when not running under Windows Subsystem for Linux (WSL), the <see cref="Clipboard"/> class X11
/// PInvoke calls.
/// On Linux, when not running under Windows Subsystem for Linux (WSL), we use X11Clipboard to call X11 PInvoke calls.
/// </para>
/// <para>
/// On Linux, when running under Windows Subsystem for Linux (WSL), the <see cref="Clipboard"/> class launches
/// On Linux, when running under Windows Subsystem for Linux (WSL), we use WslClipboard class launches
/// Windows' powershell.exe via WSL interop and uses the "Set-Clipboard" and "Get-Clipboard" Powershell CmdLets.
/// </para>
/// <para>
/// On the Mac, the <see cref="Clipboard"/> class uses the MacO OS X pbcopy and pbpaste command line tools and
/// On the Mac, we use MacClipboard class which uses the MacOS X pbcopy and pbpaste command line tools and
/// the Mac clipboard APIs vai P/Invoke.
/// </para>
/// </remarks>
Expand All @@ -73,12 +72,12 @@ public static AppBuilder UseAutoDetectClipboard(this AppBuilder builder)
}
else if (OperatingSystem.IsMacOS())
{
return builder.With<IClipboard>(new MacOSXClipboard());
return builder.With<IClipboard>(new MacClipboard());
}
else if (OperatingSystem.IsLinux())
{
if (IsWslPlatform())
return builder.With<IClipboard>(new WSLClipboard());
return builder.With<IClipboard>(new WslClipboard());
else
// alternatively use xclip CLI tool
//return builder.With<IClipboard>(new XClipClipboard());
Expand Down

0 comments on commit 8aecf8e

Please sign in to comment.