Author Topic: how to unhide hidden block of code  (Read 1283 times)

Alexander Titov

  • New Community Member
  • Posts: 1
  • Hero Points: 0
how to unhide hidden block of code
« on: January 27, 2014, 05:13:21 pm »
Hi,

I'm using SlickEdit 2011 (v16.0.3.0 64-bit) and there is a thing that exasperates me.

There is a way to hide unnecessary code (View->Hide Code Block) and then expand/collapse this code block when needed. This is very convenient. However, if you did mistake when hiding code there is no way to rectify this mistake. Yes, you can delete all hidings (View->Show All), but I want to delete only wrong hiding, not all.

Does anybody know how to unhide (not just expand!) a hidden code block?

Thank you in advance.
« Last Edit: January 27, 2014, 08:48:59 pm by Alexander Titov »

Graeme

  • Senior Community Member
  • Posts: 1981
  • Hero Points: 226
Re: how to unhide hidden block of code
« Reply #1 on: January 29, 2014, 11:19:25 am »
Does anybody know how to unhide (not just expand!) a hidden code block?

Writing this twice coz the freaking forum logged me out while I was writing it!

Use undo  - Ctrl Z.  or undo_cursor.

A mickey mouse way that might work goes like this.  If you hide a few lines, say 5,6 and 7, the plus icon appears on line 4.  If you delete line 4, slickedit gets confused regarding future hide commands on those lines.  So don't do that!  If instead you copy/delete (i.e. cut) the four lines to another temporary file, than use show-all on that file, then copy them back to the original file, slickedit seems happy.

So with the help of macro recording I wrote the following macro.
Most important - before you run the macro, save the file so you can recover if something goes wrong.  I also recommend you use backup history to check that the file is the same before and after you run the macro.  The macro creates a temporary file called "temp12345" when it runs and destroys its contents in the process.

To use the macro, save it in a file e.g. mymacros1.e and load it using the load module command on the macro menu.

Code: [Select]
#include "slick.sh"

#pragma option(strictsemicolons,on)
#pragma option(strict,on)
#pragma option(autodecl,off)
#pragma option(strictparens,on)


_command fix_hide() name_info(','VSARG2_MARK|VSARG2_REQUIRES_EDITORCTL)
{
   deselect();
   _select_char('','E');
   cursor_down(2);
   select_it('CHAR','','E');
   copy_to_clipboard();
   cursor_up(2);
   deselect();
   _select_char('','E');
   cursor_down(2);
   select_it('CHAR','','E');
   delete_selection();
   edit("temp12345");
   select_all();
   if (_select_type()=="LINE") {
      p_col=1;
   }
   delete_selection();
   paste();
   cursor_up(2);
   execute('plusminus');
   select_all();
   execute('show-all');
   copy_to_clipboard();
   prev_buffer();
   paste();
   cursor_up();
   delete_line();
}