Author Topic: Is it possible to invert the selection?  (Read 5433 times)

bschang

  • Community Member
  • Posts: 23
  • Hero Points: 1
Is it possible to invert the selection?
« on: June 25, 2008, 07:26:08 PM »
Hello:

I have a document that has some text selected. Is there a way to deselect all the text that is selected, and conversely select all of the text that had not been selected?

For instance, say I have a procedure selected in a file and I'd like to delete everything in that file other than the selected procedure. What is the best way to do this?

Thank you.

Brian Schang

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: Is it possible to invert the selection?
« Reply #1 on: June 25, 2008, 09:12:56 PM »
Inverting a selection would typically result in two disjoint selections, and that's not supported (as far as I know).

Instead you could write a DeleteEverythingButSelectedText macro which could choose from a variety of approaches for how to accomplish the results.

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: Is it possible to invert the selection?
« Reply #2 on: June 25, 2008, 09:36:03 PM »
What about: 'cut > select all > delete > paste' as recorded macro ?
HS2

Matthew

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 990
  • Hero Points: 44
Re: Is it possible to invert the selection?
« Reply #3 on: June 27, 2008, 03:55:30 AM »
You could use File > Write Selection menu command and just save over the original file. Or create a macro that uses the put command.

bschang

  • Community Member
  • Posts: 23
  • Hero Points: 1
Re: Is it possible to invert the selection?
« Reply #4 on: June 28, 2008, 09:17:41 AM »
Hello:

Thanks for the suggestions. I appreciate the input!

Brian Schang