Skip to content

feat(chat): pick more than one suggested reply with ⌘ or Ctrl held - #1303

Merged
leookun merged 1 commit into
mainfrom
reply-suggestions-multi
Nov 25, 2026
Merged

leookun merged 1 commit into
mainfrom
reply-suggestions-multi

Conversation

@leookun

@leookun leookun commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

What

  • The agent suggests two to four replies (was two or three); the prompt lets a few go together.
  • Click: the suggestion goes in the composer in place of what was there. ⌘/Ctrl-click: it goes in beside those picked, one per line, or comes out again. Enter sends them as one message; a double click still sends just the one.
  • The bar stays while the composer holds only the picked suggestions; picked ones use the theme's list.activeSelectionBackground and focusBorder, as picked options elsewhere in the chat.
  • Hover hint and the setting's description mention ⌘/Ctrl-click.

Held modifiers asked of the system

HardwareKeyboard can keep ⌘/Ctrl held after the key went up where the app did not hear it. The engine's own check at mouse events compares the system's flags with the engine's state, not the framework's (on Windows only Shift and Ctrl, on pointer moves), so every click was taken as a ⌘-click.

HeldKeys (lib/platform/held_keys.dart) asks the new heldModifiers window method (macOS NSEvent.modifierFlags, Windows GetAsyncKeyState, Linux GDK) before a click counts as ⌘/Ctrl, at a press while the app has a modifier held, and when the app comes back to the front. A modifier held for the app but not the system is let go with a synthesized key up and logged under [keys]. With no answer within 300 ms, or a key event during the question, the app's state is kept.

Tests

  • test/platform/held_keys_test.dart (new)
  • test/chat/reply_suggestions_test.dart, test/chat/reply_suggestion_bar_test.dart
  • test/kernel_ui_test.dart — "after a turn, its suggested replies …"
  • Shots in test/chat/reply_suggestions_shot_test.dart (Bao Light / Bao Dark picked) checked by eye

The native heldModifiers handlers were not built locally on any platform; Windows is left to be tried there.

🤖 Generated with BaoCode

The agent now suggests two to four replies, a few of which may go
together. A click still puts one in the composer in place of what was
there; a click with ⌘ or Ctrl held puts it in beside those picked, each
on a line of its own, or takes it out again. Enter sends them as one
message; a double click still sends just the one. The bar stays while
the composer holds only the picked ones, each shown in the theme's
list selection and focus border; typing hides it as before.

Whether ⌘ or Ctrl is held is asked of the system, not only taken from
HardwareKeyboard: the app's state can keep a modifier held after its key
went up where the app did not hear it, and the engine's own check at
mouse events compares the system's flags with the engine's state, not
the framework's (on Windows only Shift and Ctrl, on pointer moves). Every
click was then taken as a ⌘-click. HeldKeys asks the windows'
heldModifiers (NSEvent.modifierFlags, GetAsyncKeyState, GDK) before a
click counts as one with ⌘ or Ctrl, at a press while the app has a
modifier held, and when the app comes back to the front; one held for
the app but not the system is let go with a synthesized key up and
logged under [keys].

Co-Authored-By: BaoCode <noreply@baocode.dev>
@leookun
leookun merged commit 6ae4c83 into main Nov 25, 2026
3 checks passed
@kun6687
kun6687 deleted the reply-suggestions-multi branch November 25, 2026 05:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants