Author Topic: Deleting a collapsed section.  (Read 268 times)

garion911

  • Senior Community Member
  • Posts: 195
  • Hero Points: 13
Deleting a collapsed section.
« on: May 13, 2021, 06:26:07 pm »
Hi all... Just ran into an interesting possible bug:

Running on OSX, Brief keybindings, python mode.

1. Create a function:
Code: [Select]
def main():
    print "hello world"
2. Collapse the function on the def line.
3. Delete the collapsed line (delete-line). Note that you dont see any code that is in the function (that was collapsed.) As it it deleted the entire block.
4. Save the file.
5. View the with a different editor/viewer. You can see the code, minus the original line that was collapsed.
6. Reloading the file in Slick will return the view back to what the other viewer showed.

Not the behaviour I would expect... I would expect one of two different things when i delete the line:
- The entire collapsed section is deleted (what i expected when i did it initially)
- The code to 'uncollapse' then delete the single line. At least then i would know that extra code was there.

I normally dont use collapse stuff, but tried it out, and found this.

garion911

  • Senior Community Member
  • Posts: 195
  • Hero Points: 13
Re: Deleting a collapsed section.
« Reply #1 on: May 13, 2021, 06:27:18 pm »
For reference:

SlickEdit Pro 2020 (v25.0.1.0)

Serial number: VML110348
Licensed number of users: Single user
License file: /Library/Application Support/SlickEdit/25/slickedit.lic

Build Date: December 16, 2020   (State file: March 30, 2021)
Emulation: Brief

OS: macOS Catalina
OS Version: 10.15.7
Processor Architecture: Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz 64 bit (8 cores)

Memory: 99% Load, 16258MB/16384MB Virtual
Shell Information: /Applications/SlickEditPro2020.app/Contents/MacOS/secsh -i
Screen Size: 1920 x 1200, 1440 x 900

Project Type: Python
Language: .py (Python)
Encoding: UTF-8, no signature

Installation Directory: /Applications/SlickEditPro2020.app/Contents/
Configuration Directory: /Users/jsutherland/Library/Application Support/SlickEdit/25.0.1/
Migrated from: /Users/jsutherland/Library/Application Support/SlickEdit/25.0.0/
Spill File: /tmp/$slk.jsutherland.1672

Hotfixes:
/Users/jsutherland/Library/Application Support/SlickEdit/25.0.1/hotfixes/hotfix_se2501_6_cumulative.zip (Revision: 6)



Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5777
  • Hero Points: 461
Re: Deleting a collapsed section.
« Reply #2 on: May 13, 2021, 07:03:23 pm »
Interesting. I couldn't reproduce this at first. Only happens with a function at the bottom of the file/last function. I used "View>Function Headings"). We will look into this. This issue is not limited to Brief emulation.

garion911

  • Senior Community Member
  • Posts: 195
  • Hero Points: 13
Re: Deleting a collapsed section.
« Reply #3 on: May 13, 2021, 07:44:54 pm »
I had it happen in a larger file, where the function was the first function (just after imports), but had classes and
Code: [Select]
if __name__ == "__main__": after it.

Code: [Select]
import xyz
import abc

def something():   # <-- collapse this
    pass

class SomethingElse(object):
    pass

if __name__ == "__main__":
    pass

That also has the issue.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5777
  • Hero Points: 461
Re: Deleting a collapsed section.
« Reply #4 on: May 13, 2021, 08:25:11 pm »
Please post your user.cfg.xml.

I noticed that if def_auto_unsurround_block is 0, then this issue always happens no matter where the function is.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5777
  • Hero Points: 461
Re: Deleting a collapsed section.
« Reply #5 on: May 13, 2021, 08:36:02 pm »
How are you collapsing the block? I wouldn't think that would matter but I figure I should do what you're doing.

What key are you pressing to delete the line? (Command+D/Alt+D?)
« Last Edit: May 13, 2021, 08:37:36 pm by Clark »

garion911

  • Senior Community Member
  • Posts: 195
  • Hero Points: 13
Re: Deleting a collapsed section.
« Reply #6 on: May 13, 2021, 09:00:25 pm »
To delete the line, I'm using cmd-D (apple-D). For collapse, I've done it with both the menu (View|Expand/Collapse) and CTRL-\.


Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5777
  • Hero Points: 461
Re: Deleting a collapsed section.
« Reply #7 on: May 13, 2021, 09:15:30 pm »
Thanks. You've got def_auto_unsurround_block set to 0 so you don't get prompted when deleting blocks.

I've added a hot fix for this.