Search with "Whole words only" option should omit @
Search with "Whole words only" option should omit @
Hi,
when searching with the option "Whole words only", function adresses with a @ prefix will not be included in the search results. This is inconvenient when you want to search or replace a function name. The search should omit the @ character from the word characters list.
Best regards
Uwe
when searching with the option "Whole words only", function adresses with a @ prefix will not be included in the search results. This is inconvenient when you want to search or replace a function name. The search should omit the @ character from the word characters list.
Best regards
Uwe
PB 5.70 LTS (x64) - Debian Testing, Gnome 3.30.2
-
- Addict
- Posts: 4779
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Search with "Whole words only" option should omit @
Yes, it should.uwekel wrote:The search should omit the @ character from the word characters list.
And the asterisk character (*) has the same problem, already reported a long time ago.
That's why I do not search for whole words in the IDE anymore, it's just unreliable.
Since I realized this problem, I'm using a third party editor for this purpose.

That shouldn't be necessary.
Re: Search with "Whole words only" option should omit @
Well, the @ and * are part of the "word", so just include them. No biggie.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
-
- Addict
- Posts: 4779
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Search with "Whole words only" option should omit @
I would also like the world to be that simple ...PB wrote:Well, the @ and * are part of the "word", so just include them. No biggie.

You might want to read the thread to which I posted the link in my previous post, and then reconsider your statement.
if you include @ or * in the word you are searching for, then the search will not find the respective word without @ or *.
In other words, when I want to reliably search and replace a variable or procedure name, I'll have to do 3 search and replace operations:
- one with identifier
- one with @identifier
- one with *identifier
Not exactly a satisfying solution.
Re: Search with "Whole words only" option should omit @
> if you include @ or * in the word you are searching for,
> then the search will not find the respective word without @ or *
That's right and perfectly logical, because @ and * are PART OF THE NAME.
Just because those chars are not letters, doesn't mean they can be ignored.
> when I want to reliably search and replace a variable or procedure name,
> I'll have to do 3 search and replace operations
Yep, because you have 3 different and distinct objects (var, pointer, procedure).
> then the search will not find the respective word without @ or *
That's right and perfectly logical, because @ and * are PART OF THE NAME.
Just because those chars are not letters, doesn't mean they can be ignored.
> when I want to reliably search and replace a variable or procedure name,
> I'll have to do 3 search and replace operations
Yep, because you have 3 different and distinct objects (var, pointer, procedure).
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
Re: Search with "Whole words only" option should omit @
PB, i agree with the asterix *, but the @ is just an address operator to the following attached variable or function.
PB 5.70 LTS (x64) - Debian Testing, Gnome 3.30.2
Re: Search with "Whole words only" option should omit @
Hi PB. With all due respect, the @ is technically not part of the variable or procedure name.PB wrote:...@ and * are PART OF THE NAME...
...3 different and distinct objects (var, pointer, procedure).

Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel 

-
- Addict
- Posts: 4779
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Search with "Whole words only" option should omit @
Unfortunately, I can not agree:uwekel wrote:PB, i agree with the asterix * [...]
Code: Select all
a=3
b=4
Debug a*b
Agreed.TI-994A wrote:the @ is technically not part of the variable or procedure name.
Obviously, both * and @ are not (necessarily) part of an identifier name.
Re: Search with "Whole words only" option should omit @
I meant if the asterix belongs to a pointer variable.
PB 5.70 LTS (x64) - Debian Testing, Gnome 3.30.2
-
- Addict
- Posts: 4779
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Search with "Whole words only" option should omit @
Yes, of course.uwekel wrote:I meant if the asterix belongs to a pointer variable.

Humans and the compiler can make this distinction.
But the search function of the IDE doesn't know whether an asterisk belongs to a pointer variable, or whether it means "multiply".
That's part of the problem.
Re: Search with "Whole words only" option should omit @
BTW, the only reason I'm opposed to this, is because it may
lead to something getting replaced that shouldn't. When you
include the @ or * then this risk is totally removed.
lead to something getting replaced that shouldn't. When you
include the @ or * then this risk is totally removed.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
-
- Addict
- Posts: 4779
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Search with "Whole words only" option should omit @
What, for instance?PB wrote:it may lead to something getting replaced that shouldn't.
Re: Search with "Whole words only" option should omit @
Little John wrote:...both * and @ are not (necessarily) part of an identifier name.
Operators and address references never form any part of an identifier. But insofar as the search & replace is concerned, perhaps. That is why best practices recommend leaving spaces between variables and operators.Little John wrote:...the search function of the IDE doesn't know whether an asterisk belongs to a pointer variable, or whether it means "multiply"...

It would be even riskier to rename a reference to an identifier and not rename the identifier itself.PB wrote:...When you include the @ or * then this risk is totally removed.

Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel 

-
- Addict
- Posts: 4779
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Search with "Whole words only" option should omit @
Yes, that's true. I can't see where I wrote anything different.TI-994A wrote:Operators and address references never form any part of an identifier.

What obviously adds to the confusion here is, that the asterisk * can play both the role of an operator, and the role of a part of an identifier (pointer variable).
Yep!TI-994A wrote:[...] best practices recommend leaving spaces between variables and operators.
That's exactly what I'm doing when writing new PB code.
However, there are not always spaces between variables and operators in my old code, let alone code which I copied e.g. from this forum.
And this will not solve the problem with @ ...
Last edited by Little John on Wed May 21, 2014 6:23 pm, edited 1 time in total.
Re: Search with "Whole words only" option should omit @
This is one of the major reasons I always place spaces around every operator. Even the @ operator allows a space, as wrong as it looks.Little John wrote: In other words, when I want to reliably search and replace a variable or procedure name, I'll have to do 3 search and replace operations:
- one with identifier
- one with @identifier
- one with *identifier
Not exactly a satisfying solution.