fix(ui): fix live output visibility and editor dialog graying out
- Remove wrapping ScrollViewer from live output TextBox — Avalonia TextBox with AcceptsReturn handles its own scrolling; nested ScrollViewer caused layout collapse - Auto-scroll via CaretIndex instead of removed ScrollViewer - Add OnWindowClosed to both editor ViewModels, ensuring the TaskCompletionSource always resolves when the dialog closes (including via X button), preventing RelayCommand from staying permanently disabled Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -114,6 +114,11 @@ public partial class ListEditorViewModel : ViewModelBase
|
|||||||
RequestClose?.Invoke();
|
RequestClose?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnWindowClosed()
|
||||||
|
{
|
||||||
|
_tcs.TrySetResult(null);
|
||||||
|
}
|
||||||
|
|
||||||
public Task<ListEntity?> ShowAndWaitAsync()
|
public Task<ListEntity?> ShowAndWaitAsync()
|
||||||
{
|
{
|
||||||
_tcs = new TaskCompletionSource<ListEntity?>();
|
_tcs = new TaskCompletionSource<ListEntity?>();
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ public partial class MainWindowViewModel : ViewModelBase
|
|||||||
|
|
||||||
var window = new ListEditorView { DataContext = editor };
|
var window = new ListEditorView { DataContext = editor };
|
||||||
editor.RequestClose += () => window.Close();
|
editor.RequestClose += () => window.Close();
|
||||||
|
window.Closed += (_, _) => editor.OnWindowClosed();
|
||||||
_ = ShowDialogAsync(window);
|
_ = ShowDialogAsync(window);
|
||||||
|
|
||||||
var entity = await editor.ShowAndWaitAsync();
|
var entity = await editor.ShowAndWaitAsync();
|
||||||
@@ -116,6 +117,7 @@ public partial class MainWindowViewModel : ViewModelBase
|
|||||||
|
|
||||||
var window = new ListEditorView { DataContext = editor };
|
var window = new ListEditorView { DataContext = editor };
|
||||||
editor.RequestClose += () => window.Close();
|
editor.RequestClose += () => window.Close();
|
||||||
|
window.Closed += (_, _) => editor.OnWindowClosed();
|
||||||
_ = ShowDialogAsync(window);
|
_ = ShowDialogAsync(window);
|
||||||
|
|
||||||
var entity = await editor.ShowAndWaitAsync();
|
var entity = await editor.ShowAndWaitAsync();
|
||||||
|
|||||||
@@ -113,6 +113,11 @@ public partial class TaskEditorViewModel : ViewModelBase
|
|||||||
RequestClose?.Invoke();
|
RequestClose?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnWindowClosed()
|
||||||
|
{
|
||||||
|
_tcs.TrySetResult(null);
|
||||||
|
}
|
||||||
|
|
||||||
public Task<TaskEntity?> ShowAndWaitAsync()
|
public Task<TaskEntity?> ShowAndWaitAsync()
|
||||||
{
|
{
|
||||||
_tcs = new TaskCompletionSource<TaskEntity?>();
|
_tcs = new TaskCompletionSource<TaskEntity?>();
|
||||||
|
|||||||
@@ -151,6 +151,7 @@ public partial class TaskListViewModel : ViewModelBase
|
|||||||
|
|
||||||
var window = new TaskEditorView { DataContext = editor };
|
var window = new TaskEditorView { DataContext = editor };
|
||||||
editor.RequestClose += () => window.Close();
|
editor.RequestClose += () => window.Close();
|
||||||
|
window.Closed += (_, _) => editor.OnWindowClosed();
|
||||||
_ = ShowDialogAsync(window);
|
_ = ShowDialogAsync(window);
|
||||||
|
|
||||||
var saved = await editor.ShowAndWaitAsync();
|
var saved = await editor.ShowAndWaitAsync();
|
||||||
@@ -197,6 +198,7 @@ public partial class TaskListViewModel : ViewModelBase
|
|||||||
|
|
||||||
var window = new TaskEditorView { DataContext = editor };
|
var window = new TaskEditorView { DataContext = editor };
|
||||||
editor.RequestClose += () => window.Close();
|
editor.RequestClose += () => window.Close();
|
||||||
|
window.Closed += (_, _) => editor.OnWindowClosed();
|
||||||
_ = ShowDialogAsync(window);
|
_ = ShowDialogAsync(window);
|
||||||
|
|
||||||
var saved = await editor.ShowAndWaitAsync();
|
var saved = await editor.ShowAndWaitAsync();
|
||||||
|
|||||||
@@ -106,9 +106,6 @@
|
|||||||
|
|
||||||
<TextBlock Text="Live Output" FontWeight="SemiBold" FontSize="12"
|
<TextBlock Text="Live Output" FontWeight="SemiBold" FontSize="12"
|
||||||
Foreground="{StaticResource TextSecondaryBrush}" Margin="0,8,0,2"/>
|
Foreground="{StaticResource TextSecondaryBrush}" Margin="0,8,0,2"/>
|
||||||
<Border BorderBrush="{StaticResource BorderSubtleBrush}" BorderThickness="1"
|
|
||||||
CornerRadius="6" Padding="6" MaxHeight="300">
|
|
||||||
<ScrollViewer x:Name="LiveOutputScroll">
|
|
||||||
<TextBox x:Name="LiveOutputBox"
|
<TextBox x:Name="LiveOutputBox"
|
||||||
Text="{Binding LiveText, Mode=OneWay}"
|
Text="{Binding LiveText, Mode=OneWay}"
|
||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
@@ -116,12 +113,12 @@
|
|||||||
TextWrapping="NoWrap"
|
TextWrapping="NoWrap"
|
||||||
FontFamily="Consolas,Courier New,monospace"
|
FontFamily="Consolas,Courier New,monospace"
|
||||||
FontSize="11"
|
FontSize="11"
|
||||||
|
MaxHeight="300"
|
||||||
Foreground="{StaticResource TextPrimaryBrush}"
|
Foreground="{StaticResource TextPrimaryBrush}"
|
||||||
Background="Transparent"
|
BorderBrush="{StaticResource BorderSubtleBrush}"
|
||||||
BorderThickness="0"
|
BorderThickness="1"
|
||||||
Padding="0"/>
|
CornerRadius="6"
|
||||||
</ScrollViewer>
|
Padding="6"/>
|
||||||
</Border>
|
|
||||||
|
|
||||||
<Border IsVisible="{Binding HasWorktree}" BorderBrush="{StaticResource AccentBrush}"
|
<Border IsVisible="{Binding HasWorktree}" BorderBrush="{StaticResource AccentBrush}"
|
||||||
BorderThickness="1" CornerRadius="8" Padding="10" Margin="0,8,0,0">
|
BorderThickness="1" CornerRadius="8" Padding="10" Margin="0,8,0,0">
|
||||||
|
|||||||
@@ -49,8 +49,11 @@ public partial class TaskDetailView : UserControl
|
|||||||
{
|
{
|
||||||
if (e.PropertyName == nameof(TaskDetailViewModel.LiveText))
|
if (e.PropertyName == nameof(TaskDetailViewModel.LiveText))
|
||||||
{
|
{
|
||||||
var scroll = this.FindControl<ScrollViewer>("LiveOutputScroll");
|
var box = this.FindControl<TextBox>("LiveOutputBox");
|
||||||
scroll?.ScrollToEnd();
|
if (box is not null)
|
||||||
|
{
|
||||||
|
box.CaretIndex = box.Text?.Length ?? 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user