Skip to content

Commit

Permalink
Merge branch 'tomlm/fixPaste' of https://github.com/jinek/Consolonia
Browse files Browse the repository at this point in the history
…into tomlm/fixPaste
  • Loading branch information
tomlm committed Jan 9, 2025
2 parents bb01b75 + 2090e28 commit 690143f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 12 additions & 5 deletions src/Consolonia.Core/Infrastructure/ClipboardImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Threading.Tasks;
using Avalonia.Input;
using TextCopy;
using IClipboard = Avalonia.Input.Platform.IClipboard;

namespace Consolonia.Core.Infrastructure
{
Expand All @@ -11,11 +12,13 @@ namespace Consolonia.Core.Infrastructure
// for linux and mac it has a ton of dependencies on the entire rendering subsystem.
// This is a temporary solution to get the clipboard working, but it is not a good solution for linux as it relies
// on invoking a shell command to get the clipboard content, and doesn't support GetData/SetData/GetFormats
internal class ClipboardImpl : Avalonia.Input.Platform.IClipboard
internal class ClipboardImpl : IClipboard
{
#pragma warning disable CA1822 // Mark members as static
public Task ClearAsync()
=> ClipboardService.SetTextAsync(string.Empty);
{
return ClipboardService.SetTextAsync(string.Empty);
}

public Task<object> GetDataAsync(string format)
{
Expand All @@ -28,14 +31,18 @@ public Task<string[]> GetFormatsAsync()
}

public Task<string> GetTextAsync()
=> ClipboardService.GetTextAsync();
{
return ClipboardService.GetTextAsync();
}

public Task SetDataObjectAsync(IDataObject data)
{
throw new NotImplementedException();
}

public Task SetTextAsync(string text)
=> ClipboardService.SetTextAsync(text ?? String.Empty);
{
return ClipboardService.SetTextAsync(text ?? string.Empty);
}
}
}
}
2 changes: 0 additions & 2 deletions src/Consolonia.Core/Infrastructure/ConsoloniaPlatform.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Diagnostics;
using System.Reflection;
using Avalonia;
using Avalonia.Controls.Platform;
using Avalonia.Input;
Expand Down Expand Up @@ -89,7 +88,6 @@ public void Initialize()
//{
// //.Bind<IClipboard>().ToConstant(new X11Clipboard(this))
//}

}

[DebuggerStepThrough]
Expand Down

0 comments on commit 690143f

Please sign in to comment.