Repository navigation
fix(chat): a selection made while the bar shows has its bar too - #1309
Merged
Merged
Conversation
Only every other drag had the bar over its selection. A press in the history takes the bar away and, as it starts a selection, has it come back; the bar's tap region then heard the same press (it hears it later, being higher up), as one outside it, and took it away again for the whole drag. The next drag, no bar showing, had one. It now leaves the history's own presses to the history. Test: a second drag while the bar shows has its bar, over its text; a press outside the history still takes it away. It failed before (no bar). 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.
Follow-up to #1301. In a recording (Windows), only every other drag in the conversation got the Copy / Quote / By the Way bar: a drag begun while the bar still showed never had one; the next (no bar showing) did.
Cause. The history's
Listenerhears a press first (it is deeper):_handlePointerDownhides the bar, then, as the press may select, sets_pointerSelects = true, and the selection starting schedules the bar. The old bar'sTapRegionis still mounted in that event (it is rebuilt only on the next frame), and theTapRegionSurfacehigher up then reports the same press to it as one outside:onTapOutside→_hideBubble()→_pointerSelects = false, so nothing shows for the whole drag.Fix.
_handlePointerDownrecords the press's pointer; the bar'sonTapOutsideignores that press (a press elsewhere in the app still hides the bar).Test (
test/chat/history_selection_test.dart): a second drag while the bar shows has a bar, over the second paragraph; a press outside the history takes it away. Without the fix: no bar found.history_selection_test,user_message_selection_test,markdown_preview_test,message_edit_visibility_test,sticky_message_testpass (but for the known pending-timer failure of the first test inmessage_edit_visibility_testonmain).🤖 Generated with BaoCode