diff --git a/src/ClaudeDo.Ui/Views/Islands/NotesEditorView.axaml b/src/ClaudeDo.Ui/Views/Islands/NotesEditorView.axaml index 1fa35a61..b04a09f6 100644 --- a/src/ClaudeDo.Ui/Views/Islands/NotesEditorView.axaml +++ b/src/ClaudeDo.Ui/Views/Islands/NotesEditorView.axaml @@ -45,14 +45,14 @@ + - - - - + AcceptsReturn="True" TextWrapping="Wrap" + VerticalAlignment="Center" Margin="12,0,0,0"/> diff --git a/src/ClaudeDo.Ui/Views/Islands/NotesEditorView.axaml.cs b/src/ClaudeDo.Ui/Views/Islands/NotesEditorView.axaml.cs index e53bf237..dbfb02e6 100644 --- a/src/ClaudeDo.Ui/Views/Islands/NotesEditorView.axaml.cs +++ b/src/ClaudeDo.Ui/Views/Islands/NotesEditorView.axaml.cs @@ -21,6 +21,7 @@ public partial class NotesEditorView : UserControl AddHandler(KeyDownEvent, OnBulletKeyDown, RoutingStrategies.Tunnel); } + private void OnDataContextChanged(object? sender, EventArgs e) { if (_vm is not null) _vm.FocusRequested -= FocusBullet; @@ -37,13 +38,27 @@ public partial class NotesEditorView : UserControl private void OnBulletKeyDown(object? sender, KeyEventArgs e) { - // Source, not sender: the tunnel handler is attached to the whole view, so this also sees - // keys from the capture box at the top — which has no bullet behind it and is skipped. - if (e.Source is not TextBox { DataContext: NoteBulletViewModel bullet } box - || DataContext is not NotesEditorViewModel vm) return; + // Source, not sender: the tunnel handler is attached to the whole view, so it sees the + // capture box at the top as well as the note rows. Both need the same Enter/Shift+Enter + // split, and neither can get it from a KeyBinding — with AcceptsReturn on, TextBox eats + // Enter in its own OnKeyDown before any bubbling handler or binding runs. + if (e.Source is not TextBox box || DataContext is not NotesEditorViewModel vm) return; + var shift = e.KeyModifiers.HasFlag(KeyModifiers.Shift); + + if (ReferenceEquals(box, NewNoteBox)) + { + if (e.Key == Key.Enter && !shift) + { + e.Handled = true; + vm.AddBulletCommand.Execute(null); + } + return; + } + + if (box.DataContext is not NoteBulletViewModel bullet) return; // Shift+Enter falls through to the TextBox and breaks the line — a note can be several. - if (e.Key == Key.Enter && !e.KeyModifiers.HasFlag(KeyModifiers.Shift)) + if (e.Key == Key.Enter && !shift) { e.Handled = true; vm.SplitBulletCommand.Execute(bullet);