fix(ui): report failed paste/drop in the interactive terminal

PasteAsync silently swallowed every exception and returned void, so a
package update renaming Iciclecreek's private write seam would break
Ctrl+V/drop with zero user-visible signal. PasteAsync/SendTextAsync now
return bool (mirroring SendLineAsync), and the view checks the result,
routing a failure through InteractiveTerminalViewModel.ErrorReported ->
ConPtyPaneViewModel.ErrorReported -> the existing footer error strip.
This commit is contained in:
mika kuns
2026-09-10 13:35:16 +02:00
parent acff815706
commit 0cec0a77ee
9 changed files with 112 additions and 9 deletions
@@ -162,15 +162,19 @@ public sealed class PtyTerminalSession : IDisposable
/// writing the clipboard text raw, because that is what honours bracketed-paste mode — without
/// it a multi-line paste is read line by line and submits on the first newline.
/// </summary>
public async Task PasteAsync()
public async Task<bool> PasteAsync()
{
if (_control is not { } control || !IsRunning) return;
if (_control is not { } control || !IsRunning) return false;
try
{
if (s_terminalViewField?.GetValue(control) is TerminalView view)
await view.PasteAsync();
if (s_terminalViewField?.GetValue(control) is not TerminalView view) return false;
await view.PasteAsync();
return true;
}
catch (Exception)
{
return false;
}
catch (Exception) { /* best-effort, same as SendLineAsync */ }
}
// Long enough that the two writes can't be read as one chunk by the child's stdin reader.