Repository navigation
feat(chat): pick more than one suggested reply with ⌘ or Ctrl held - #1303
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
list.activeSelectionBackgroundandfocusBorder, as picked options elsewhere in the chat.Held modifiers asked of the system
HardwareKeyboardcan 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 newheldModifierswindow method (macOSNSEvent.modifierFlags, WindowsGetAsyncKeyState, 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.darttest/kernel_ui_test.dart— "after a turn, its suggested replies …"test/chat/reply_suggestions_shot_test.dart(Bao Light / Bao Dark picked) checked by eyeThe native
heldModifiershandlers were not built locally on any platform; Windows is left to be tried there.🤖 Generated with BaoCode