Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 Modify expression error
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

MikMik
Senior Member

42 Posts

Posted - Oct 05 2021 :  11:02:51 AM  Show Profile  Reply with Quote
Hi,
I've tried to use Modify Expression a few times with no luck. Every time, the expression is modified correctly, but the output is placed somewhere else, not at its original place.




Any ideas why this might be or is it a bug?

Edited by - MikMik on Oct 05 2021 11:05:06 AM

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Oct 05 2021 :  11:57:38 AM  Show Profile  Reply with Quote
That's rather disturbing!

First the easy bit, which IDE and version of VA are you using?

When you see this problem, if you undo the modify expression and then trigger it a second time, do you get the same problem?

If, once the problem has appeared, you change file, e.g. via Alt-O, and then change back again, do you still see the problem? I am just trying to double check if this is "simply" a display problem, or if the new version of the expression has been placed in the wrong place.

Either way, trying to think of possible triggers or factors... do you have:

IDE tools menu -> Options -> Environment -> Documents -> Check for consistent line endings on load

turned On? If not can you please try turning it On and see if your files have mixed line endings.

Do you have blocks of code folded further up the file?

If you show VA Outline or the Alt-M list are these showing the correct information for the file, before you have this problem? I am looking for signs that VA is confused by the file, which might help to explain this.

zen is the art of being at one with the two'ness
Go to Top of Page

Dusan
Whole Tomato Software

Slovakia
177 Posts

Posted - Oct 05 2021 :  12:52:09 PM  Show Profile  Reply with Quote
Hi MikMik,
I am the developer of the feature and I am sorry to see that it does not work for you.

I have some questions in addition to feline's.

Could you please check if your source code contains Unicode consisting of surrogate pairs?

How do you start the feature?

Where is the caret when you start the feature?

Does the feature create a selection over the expression when you apply the result?
If so, is the selection in correct place or is around the result?

Does Smart Select work properly in your source code?
Please try to extend and shrink selection using Smart Select
inside of the expression.

Can you reproduce the problem in a very simple file?

Edited by - Dusan on Oct 05 2021 9:42:36 PM
Go to Top of Page

MikMik
Senior Member

42 Posts

Posted - Oct 06 2021 :  02:28:38 AM  Show Profile  Reply with Quote
Hi, thanks for your answers. I will try to answer all of your questions.
I'm using Visual Studio 2019 Enterprise (the last version, just updated to 16.11.4) and the latest version of Visual Assist (build 2420).
It doesn't seem like a display issue. The code is actually in the wrong place. I've tried going to a new file afterwards and coming back, undoing and doing again... Also, I can edit it afterwards and it is where I see it.
Both Alt+M and VA Outline seem to be perfectly correct, and I don't seem to have mixed line endings. I do have mixed spaces/tabs, though.
I've tried toggling all outlining so I guees there are no folded code blocks, but I haven't checked the whole file (it's BIG).

I don't think the file contains any Unicode. It is an ANSI file.
The result is the same no matter how I start the feature (through the menu, Shift+Alt+Q and then Modify Expression, through custom shortcut...). To start the feature, I place the caret at "&&", or I select the whole expression... If I place it inside a subexpression it changes the subexpression but places the result in the wrong place too.
After applying the command, there is a selection around the result (at the wrong place).
And SmartSelect works perfectly, as far as I can tell.

I've seen it work correctly in some files but I haven't been able to pinpoint what's the difference.

We have some huge files (20000, 50000 lines) and have some weird alignments and "features", such as colons after parens in if or while blocks, but there are no templates or any heavy macro usage.



Go to Top of Page

MikMik
Senior Member

42 Posts

Posted - Oct 06 2021 :  02:53:54 AM  Show Profile  Reply with Quote
Good news (I guess)!
I've done some further tests and I've been able to create a minimal example that reproduces the problem. It seems to be an encoding issue:








There is a comment with a "weird" character. It should be "�", but at some point it was "translated" to "�" (as far as I can tell "�" is OEM850 0xA2; and "�" is ANSI 0xA2).

It seems like the block is moved one character for each time the "weird" character appears in the file.
In files with thousands of lines, there are many chances to find such characters...

EDIT: I've tried replacing the "�" with "�" again (or any letter with an accent) and it still does not work. Also, I've converted the file to UTF-8 and UCS-2, and I get the same result

Edited by - MikMik on Oct 06 2021 03:14:33 AM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Oct 06 2021 :  05:56:15 AM  Show Profile  Reply with Quote
Thank you for pinning down the trigger, I am able to easily reproduce the problem here in a file with Unicode characters:

case=146282

zen is the art of being at one with the two'ness
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Oct 06 2021 :  06:01:38 AM  Show Profile  Reply with Quote
I have a sort of work around. In my test cases smart select works correctly, so I can trigger Modify Expression, select and copy the modified version out of the dialog, cancel the dialog, and then use smart select, ALT+SHIFT+] to quickly and easily select the entire expression, and the paste in the modified version.

Not quite the same, but it does let you safely modify the expressions.

zen is the art of being at one with the two'ness
Go to Top of Page

MikMik
Senior Member

42 Posts

Posted - Oct 06 2021 :  06:04:27 AM  Show Profile  Reply with Quote
Thanks for the workaround. As you say, it's not the same, but it's better, and less error-prone, than changing it by hand...
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000