[PB IDE 4.50] Block-select find/replace selection

Post bugs related to the IDE here
User avatar
USCode
Addict
Addict
Posts: 912
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle, USA

[PB IDE 4.50] Block-select find/replace selection

Post by USCode »

If I select a block of text in the PB IDE using Ctrl-Alt, then choose to do a Find/Replace in that block of text with the Search Inside selection only, I expected only that text inside the text block to be changed. However the PB IDE is changing all the matching characters on the entire selected lines, not limiting itself to within the selected text block only.
User avatar
STARGÅTE
Addict
Addict
Posts: 2088
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: [PB IDE 4.50] Block-select find/replace selection

Post by STARGÅTE »

Window - Find/Replace
[x] Search inside Selection only
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
USCode
Addict
Addict
Posts: 912
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle, USA

Re: [PB IDE 4.50] Block-select find/replace selection

Post by USCode »

STARGÅTE wrote:Window - Find/Replace
[x] Search inside Selection only
I don't follow what you're saying?
User avatar
Vera
Addict
Addict
Posts: 858
Joined: Tue Aug 11, 2009 1:56 pm
Location: Essen (Germany)

Re: [PB IDE 4.50] Block-select find/replace selection

Post by Vera »

Hi USCode,

STARGÅTE only kind of asked you, if you might have missed to check the checkbox

Image inside selection only

on the search/replace GUI.

greetings ~ Vera
User avatar
USCode
Addict
Addict
Posts: 912
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle, USA

Re: [PB IDE 4.50] Block-select find/replace selection

Post by USCode »

Vera wrote:Hi USCode,

STARGÅTE only kind of asked you, if you might have missed to check the checkbox

Image inside selection only

on the search/replace GUI.

greetings ~ Vera
I mentioned it in my original post but I guess not very clearly. Yep, I have "Search inside selection only" checked.
Otherwise it would perform the search/replace throughout the entire file.
The problem here is it is doing the search/replace on the entire lines I have selected but it should only be doing it in the actual (ctrl-alt) text block I have selected.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: [PB IDE 4.50] Block-select find/replace selection

Post by PB »

@USCode: You should provide reproducible steps to show it,
as I have been unable to see the problem when replacing the
text "th" in the below code. Works fine for me.

Code: Select all

path="C:\" ; Unselected.
a$="this is a test"
thick=1
i=CreateImage(thick,640,480)
th=999 ; Also unselected.
In my testing of the above, both commented lines do NOT have
"th" replaced at all. Only the selected lines in the middle (lines
2, 3 and 4) have "th" replaced. I even tried a vertical block
selection (holding down Alt while selecting with the mouse)
and it still worked as expected.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
USCode
Addict
Addict
Posts: 912
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle, USA

Re: [PB IDE 4.50] Block-select find/replace selection

Post by USCode »

PB wrote:@USCode: You should provide reproducible steps to show it ...
PB you're right, I need to provide a clear example as this is rather rare corner case but sometimes it can be useful when using block-select.

For example, here's a screenshot of a section of spaces block-selected:
Image

In the example above after hitting "Replace All" you would expect all the blanks selected in the code block to be changed to *, but this is what happens:
Image

Not really a good real-world example but it gets the idea across. In the past with other editors I've normally used this block-text find/replace feature to generate sample text data by using the editor. Bottom-line, the editor should only be performing the find/replace inside the selected area.
HTH in understanding the issue.
User avatar
Vera
Addict
Addict
Posts: 858
Joined: Tue Aug 11, 2009 1:56 pm
Location: Essen (Germany)

Re: [PB IDE 4.50] Block-select find/replace selection

Post by Vera »

Hello USCode,

now with the closer infos I could check what you meant far better and found out it's the same on Win as on Linux, and it also occurs in former versions.

After testing a lot of possibilities I found out in the end it is due to the cursor's start and endposition and not to the 'selected' (highlighted) text.

The first image shows the selected text for all 4 possible ways of marking a block and below the two corresponding results:
1 - downwards to left (behind)
1 - upwards to right (ahead)
2 - upwards to left (behind)
2 - downwards to right (ahead)

Image

The second image shows that a block-selection beyond text of the same length can only be done by one way (backwards) and here the result is even more obvious.

Image

It's kind of true that only the selected text is taken for search and replace - but the marking points are obtained by the cursors positions.

Still this is very missleading compared to e.g. copy / paste actions with selected blocks and may lead to corrupting the code if you're not aware of it.

So it should at least be mentioned in the IDE handling description unless it cannot be changed to an expected behaviour.

greetings ~ Vera
Post Reply