Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Move line up/down has incorrect behavior in edge cases in inline editorΒ #3130

Closed

Description

@njx
  1. Open the Getting Started project
  2. Put the cursor in the tag
  3. In the inline editor, put the cursor inside the comment ("/* hide samp...")
  4. Edit > Move Line Down until it gets to the bottom
  5. Put the cursor in the last line (the brace)
  6. Edit > Move Line Up

Result:

  • In (4), the line can't be moved to the last line of the editor.
  • In (6), the editor shrinks, hiding the line below the brace.

Activity

  1. njx commented on Mar 14, 2013

    @njx
    Author

    These are leftover issues after the fix for #1933. I don't think they're very high priority--you probably usually don't want to move a line outside of the end of the rule/function anyway (or move the end line above other content). But it feels asymmetric since the same issues don't occur at the top; it's almost like we should consider actually making the same behavior happen at the top. Also, in the future we might have some other kinds of inline editors for which this behavior would be less sensible.

    Marking low priority.

  2. TomMalbran commented on Mar 14, 2013

    @TomMalbran
    Contributor

    The problem here is that moving the line down to the last line in the inline editor triggers the special case in TextRange.prototype._applySingleChangeToRange, and closes the editor, which I found out that is the right call. So to get a better fix it would require to handle this special case and be able to move down every time. Or it would be easy enough to make it asymmetric.

  3. njx commented on Mar 18, 2013

    @njx
    Author

    @TomMalbran - I haven't had a chance to dig into your code, but I think the general issue is that the TextRange is very sensitive to whether a replacement crosses the boundary. In the Move Line Down code, does it replace the \n at the end of the line below? If it does, a fix might be to make it so that in this special case, you change things around so it replaces the \n at the beginning instead, or something similar.

  4. njx commented on Mar 18, 2013

    @njx
    Author

    Reviewed--assigning to @TomMalbran to look at.

  5. jasonsanjose commented on Apr 17, 2013

    @jasonsanjose
    Member

    Confirmed fixed. Auto closed by pull #3233.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions