Discussion:
Feature Request: Multi-Select
(too old to reply)
Skybuck Flying
2011-06-12 08:17:05 UTC
Permalink
Hello,

Sometimes a "replace" operation should only happen on certain pieces of
text.

It's too risky to before the replace on an entire piece of text.

Therefore I am requesting "multi-select".

It would work as follows, for example:

The programmer holds the control key and then select some text with the
mouse cursor down and up.

When the mouse cursor goes up the programmer continues to hold the control
key.

The programmer can now select more text with the mouse cursor.

Only the pieces of texts that were selected by the programmer are selected.

These "multiple selections" should then be able to be used for a
edit->replace operation.

This way somewhat more safe replace operations can be done safely and at
high speed.

Bye,
Skybuck.
Rob Kennedy
2011-06-16 03:57:52 UTC
Permalink
Post by Skybuck Flying
Sometimes a "replace" operation should only happen on certain pieces of
text.
It's too risky to before the replace on an entire piece of text.
Delphi 2005 introduced two solutions to that problem:

1. Select a block of text and press the "sync edit" button in the
gutter. While in that mode, changes you make to any word will be applied
simultaneously to all other occurrences of that word in the selection area.

2. Use the "rename" refactoring tool to change the name of all
occurrences of a variable, function, or type name within the current
project. This tool is aware of Delphi's scoping rules, so renaming one
variable named "tmp" won't rename *all* the tmp variables in your file,
just the one you selected and all the places that variable is used.
--
Rob
Skybuck Flying
2011-06-16 13:47:55 UTC
Permalink
Will these methods work for the following problem ?:

The asterixes (*) have to be removed and inserted with two slashes (//).

Just pretend there is a tab character in front of each line.

//
//
//
*
//
//
*

.. Some Code...

//
*
//
*
//
*
//
//
*
*
//
//

The problem is the asterix (*) cannot be removed with a replace all because
the code which was converted from C/C++ might contain a lot of asterixes(*).

For example multiplications, and pointer dereferencing, therefore performing
such a replace all is way too risky.

The fastest method would probably be to manually multi-select all these
little stars and replace them all at once.

That would still be faster then trying to user cursor keys and doing a
manually insertion-override/replace everytime.

Since the asterix has to be selected as well with either mouse or cursor
keys to replace it, including any spaces or tabs that was in front of it.

And then ofcourse replacing * with //.


Anyway I tried your first suggestion, selecting the text.

Nothing appears in the gutter in Delphi XE ?!? Any idea how to active
Sync-Edit at all ?!?

Can Sync-Edit "edit comments as well" ?

Your second suggestion only applies to code/variables.


What I am looking for is a general editing tool which can edit anything,
thus a multi-select would be welcome to speed replace operation up.

Bye,
Skybuck.

P.S.: Take care ;) :)

Loading...