Page 1 of 2

Search with "Whole words only" option should omit @

Posted: Tue May 20, 2014 1:30 pm
by uwekel
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

Re: Search with "Whole words only" option should omit @

Posted: Tue May 20, 2014 3:06 pm
by Little John
uwekel wrote:The search should omit the @ character from the word characters list.
Yes, it should.
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 @

Posted: Wed May 21, 2014 9:11 am
by PB
Well, the @ and * are part of the "word", so just include them. No biggie.

Re: Search with "Whole words only" option should omit @

Posted: Wed May 21, 2014 9:19 am
by Little John
PB wrote:Well, the @ and * are part of the "word", so just include them. No biggie.
I would also like the world to be that simple ... :-) Unfortunately, this is not the case.
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 @

Posted: Wed May 21, 2014 11:07 am
by PB
> 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).

Re: Search with "Whole words only" option should omit @

Posted: Wed May 21, 2014 11:11 am
by uwekel
PB, i agree with the asterix *, but the @ is just an address operator to the following attached variable or function.

Re: Search with "Whole words only" option should omit @

Posted: Wed May 21, 2014 11:15 am
by TI-994A
PB wrote:...@ and * are PART OF THE NAME...

...3 different and distinct objects (var, pointer, procedure).
Hi PB. With all due respect, the @ is technically not part of the variable or procedure name. :D

Re: Search with "Whole words only" option should omit @

Posted: Wed May 21, 2014 11:28 am
by Little John
uwekel wrote:PB, i agree with the asterix * [...]
Unfortunately, I can not agree:

Code: Select all

a=3
b=4
Debug a*b
TI-994A wrote:the @ is technically not part of the variable or procedure name. :D
Agreed.

Obviously, both * and @ are not (necessarily) part of an identifier name.

Re: Search with "Whole words only" option should omit @

Posted: Wed May 21, 2014 11:32 am
by uwekel
I meant if the asterix belongs to a pointer variable.

Re: Search with "Whole words only" option should omit @

Posted: Wed May 21, 2014 11:37 am
by Little John
uwekel wrote:I meant if the asterix belongs to a pointer variable.
Yes, of course. :-) I know.

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 @

Posted: Wed May 21, 2014 11:47 am
by PB
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.

Re: Search with "Whole words only" option should omit @

Posted: Wed May 21, 2014 12:08 pm
by Little John
PB wrote:it may lead to something getting replaced that shouldn't.
What, for instance?

Re: Search with "Whole words only" option should omit @

Posted: Wed May 21, 2014 12:10 pm
by TI-994A
Little John wrote:...both * and @ are not (necessarily) part of an identifier name.
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"...
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. :)
PB wrote:...When you include the @ or * then this risk is totally removed.
It would be even riskier to rename a reference to an identifier and not rename the identifier itself. :)

Re: Search with "Whole words only" option should omit @

Posted: Wed May 21, 2014 12:42 pm
by Little John
TI-994A wrote:Operators and address references never form any part of an identifier.
Yes, that's true. I can't see where I wrote anything different. :-)
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).
TI-994A wrote:[...] best practices recommend leaving spaces between variables and operators. :)
Yep!
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 @ ...

Re: Search with "Whole words only" option should omit @

Posted: Wed May 21, 2014 3:40 pm
by Tenaja
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.
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.