Skip to content

Folding via fold/unfold commands selects folded/unfolded text #5797

Open
@deathaxe

Description

Description of the bug

Folding experience differs depending on using fold buttons or key bindings.

Steps to reproduce

  1. Start ST in SAFE MODE...
  2. Paste the following code into a new view and set Python syntax
    def function():
        """
        This is a funciton
               :returns: nothing
        """
        pass
  3. Move caret after the opening doc comment punctuation (end of line 2)
  4. Hit ctrl+shift+[ to fold the comment (=> folded region is selected, caret moved to the end)
  5. Move caret back to original position
  6. Hit ctrl+shift+] to unfold the comment (=> folded region is selected, caret moved to the end)

Expected behavior

Folding and unfolding should

  1. not manipulate selections, except removing those from folded regions.
  2. not move caret in case it is already at the beginning or the end of a folded/unfolded region.

Folding/unfolding should behave the same way, no matter whether it is invoked via fold buttons or key bindings.

Actual behavior

Folded regions and unfolded regions are selected with the caret being placed at the end of the folded region.

Animation

Sublime Text build number

4147

Operating system & version

Windows 10

(Linux) Desktop environment and/or window manager

No response

Additional information

No response

OpenGL context information

No response

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions