-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SuperEditor] - moving caret with up and down arrows generates a SelectionChangeEvent of type collapsedSelection #2367
Comments
@JostSchenck for clarity, can you list all the movement types that you think we should include? |
@matthew-carroll Generally, I would like to have a way of knowing in reactions when a movement was triggered by left, right, up, down, and possibly know if a by-word- or by-paragraph-modifier was used. This would allow for use-cases like mine to reuse more of the super_editor standard setup by implementing all required behaviors in the reactions. |
@angelosilvestre can you spend a few minutes filling out a comment here about what we have vs what we need to fully offer these details? I think this issue involves requests, commands, and events. For example, consider moving selection by word. We probably want the following pieces:
For each such situation, please note whether we already have the given request, command, and selection event details. After you audit those details, we can circle back, finalize what we want, and then this ticket will be ready for work. |
current super_editor, main branch
I'm writing a reaction which has correct the caret position if the user has moved the caret into a region of the document which is supposed to be currently hidden. For this, I search the changeList for a
SelectionChangeEvent
of typeSelectionChangeType.pushCaret
. This works for simple upstream/downstream movement of the caret by pressing left or right arrows. However, when the user presses up or down buttons, the current implementation inCommonEditorOperations.moveCaretUp
andmoveCaretDown
will instead produce aSelectionChangeType.collapseSelection
, even when the selection was already collapsed before. Maybe I misunderstood the change types, but to me this naming is confusing.I would expect
moveCaretUp
andmoveCaretDown
to fire an event ofcollapseSelection
when there actually was an expanded selection before, else fire an event ofpushCaret
. IfpushCaret
for some reason was meant for one-step only movements, I'd rather expect another type ofmoveCaret
.I can work around this by reacting to
collapseSelection
as well; I still think this is confusing.The text was updated successfully, but these errors were encountered: