fix(claude-do): merge ConPTY tiles: deliver AltGr characters (@, \, {, }, €, …) as
ClaudeDo-Task: 4abf8b93e1d94c98b122521a8b850a77
This commit is contained in:
@@ -40,6 +40,15 @@ public partial class InteractiveTerminalView : UserControl
|
||||
|
||||
private void OnPreviewKeyDown(object? sender, KeyEventArgs e)
|
||||
{
|
||||
// AltGr arrives as Ctrl+Alt; the library would turn it into a control sequence (and mark it handled).
|
||||
if (IsAltGrText(e.KeyModifiers, e.KeySymbol))
|
||||
{
|
||||
if (DataContext is not InteractiveTerminalViewModel altGrVm) return;
|
||||
e.Handled = true;
|
||||
_ = SendTextAndReportAsync(altGrVm, e.KeySymbol!);
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.Key != Key.V || !e.KeyModifiers.HasFlag(KeyModifiers.Control) || e.KeyModifiers.HasFlag(KeyModifiers.Alt))
|
||||
return;
|
||||
if (DataContext is not InteractiveTerminalViewModel vm) return;
|
||||
@@ -120,6 +129,12 @@ public partial class InteractiveTerminalView : UserControl
|
||||
vm.ReportSendFailed();
|
||||
}
|
||||
|
||||
/// <summary>True for an AltGr keystroke (Windows reports it as Ctrl+Alt) whose
|
||||
/// <paramref name="keySymbol"/> is already a single printable character, e.g. "@" or "\".</summary>
|
||||
internal static bool IsAltGrText(KeyModifiers modifiers, string? keySymbol) =>
|
||||
modifiers.HasFlag(KeyModifiers.Control) && modifiers.HasFlag(KeyModifiers.Alt)
|
||||
&& keySymbol is { Length: 1 } && !char.IsControl(keySymbol[0]);
|
||||
|
||||
/// <summary>Joins dropped file paths into one insertable chunk: quoted when they contain a
|
||||
/// space, space-separated, with a trailing space so the user can keep typing.</summary>
|
||||
internal static string FormatDroppedPaths(IEnumerable<string?>? paths)
|
||||
|
||||
Reference in New Issue
Block a user