Replace with block marked

Posted by Thomas Mercer-Hursh on 21-Sep-2013 11:31

Using Alt-Shift-A to switch to block selection is very useful, but it doesn't do one thing I expect it to do, i.e., to limit the Ctrl-F replacements to the marked block.   I had a block assignment which I copied.  The original was buffer fields being assigned to object properties, but in the new use I needed object properties assigned to buffer fields.  I.e., the original had : on the left and . on the right, but I needed the reverse in the new use.  Clearly, the easy thing to have done was to have changed the punctuation at the same time I was replacing the buffer name and object name, but I didn't do that.  But, I figured I could mark the block with the :s and change just them to . and vice versa, but what actually happens is that they all change in the scope of lines.  So, one ends up with all one mark.

This seems wrong, but I suppose someone will say it is standard Eclipse editor behavior ...

All Replies

Posted by Stefan Drissen on 23-Sep-2013 15:14

tamhas wrote:

This seems wrong, but I suppose someone will say it is standard Eclipse editor behavior ...

Happy to oblige, see Eclipse bug 326836 (only 3 years old).

Work-around (I think) is to cut / paste the block to a blank section, find / replace and then cut / paste the block back. It would seem no one actually types code anymore... ;-)

Posted by Thomas Mercer-Hursh on 23-Sep-2013 15:24

I don't think it was doing the search and replace in the whole editor, but rather on the whole of the lines from the top of where the block was marked to the bottom.  I.e., the top and bottom were observed, but the sides were not.

The workaround, at least for my cases, is to make sure to include part of what is on one side or the other of the thing one wants to change so that it is unique.

Posted by Stefan Drissen on 23-Sep-2013 15:27

tamhas wrote:

I don't think it was doing the search and replace in the whole editor, but rather on the whole of the lines from the top of where the block was marked to the bottom.  I.e., the top and bottom were observed, but the sides were not.

The workaround, at least for my cases, is to make sure to include part of what is on one side or the other of the thing one wants to change so that it is unique.

Yes, you see the selection switch to all lines within your block as soon as you press Ctrl+F.

Posted by Thomas Mercer-Hursh on 23-Sep-2013 15:32

Ah, yes, I see that now.

I take it that holding of breath is not indicated ...

This thread is closed