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 type SelectionChangeType.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 in CommonEditorOperations.moveCaretUp and moveCaretDown will instead produce a SelectionChangeType.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 and moveCaretDown to fire an event of collapseSelection when there actually was an expanded selection before, else fire an event of pushCaret. If pushCaret for some reason was meant for one-step only movements, I'd rather expect another type of moveCaret.
I can work around this by reacting to collapseSelection as well; I still think this is confusing.
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
SelectionChangeEventof 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.moveCaretUpandmoveCaretDownwill 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
moveCaretUpandmoveCaretDownto fire an event ofcollapseSelectionwhen there actually was an expanded selection before, else fire an event ofpushCaret. IfpushCaretfor some reason was meant for one-step only movements, I'd rather expect another type ofmoveCaret.I can work around this by reacting to
collapseSelectionas well; I still think this is confusing.