-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Move Line(s) Up in inline editor does not keep correct highlight of the moved lines #1343
Comments
This only happens when moving lines up -- not down. Updating description... |
The EditorCommandHandlers code is requesting the correct selection when it calls setSelection(), and Editor even reports that same selection after that call... but then a moment later, the selection becomes incorrect. I think the problem is that we're setting selection within the same batch operation that edited the text. CodeMirror appears to defer some processing of the text updates but not the selection updates -- it appears to actually set the selection first and then process the text edits, losing the top line of the selection in the process. Not clear if that's a CodeMirror bug, feature, or what... needs a bit more investigation. |
Reviewed |
Moving to sprint 14. |
Moving to sprint 15. |
I should still be able to investigate this one within Sprint 15 |
Moving to sprint 16. |
Moved out to later (sprint 18) after the V3 has been merged |
CM v3 won't be merged in Sprint 18, so moving further out... |
Moving to sprint 20 since we're not doing the final v3 merge until then. |
Note: I was wrong about the old external pull request. I don't believe #2431 is related to this issue. |
Still reproduces in v3. |
Actually, it's not a bug in CodeMirror--it was a bonafide bug in our code. The issue is that the batching is happening on the "document" (which is really the full editor), but we're setting the selection on the inline editor. So the selection is getting set on the inline editor, then the operation ends (updating the document), then the document change gets synced back to the inline editor (modifying the selection we had just set). The fix is just to move the setting of the inline editor's selection out of the document's operation, since it doesn't really belong in there anyway. |
FBNC @RaymondLim |
Fix confirmed. |
Result: Only the first two (just moved) lines are highlighted, not all three lines. If you repeat step 1 and 2 again, then you lose another line in highlight.
The text was updated successfully, but these errors were encountered: