Editing file will change location in Find results

Having trouble installing Oxygen? Got a bug to report? Post it all here.
ajuan
Posts: 18
Joined: Fri Mar 27, 2015 8:17 pm

Editing file will change location in Find results

Post by ajuan »

Hello,

If I run Find for a term in oXygen, I get a panel of results. If I double-click on one of those results, it will take me to that file and then highlight the exact location of where the term I searched for is. This is a great feature that is often used.

However, if I make a change to the file (say because I want to remove the mention of this term, or add additional information where ever this term is located), then the location of the term can shift in the file. As such, when I double-click on the next result in the Results tab, the highlighted section in the file might be a few lines away from where the actual searched-for term is.

Is there a setting that can fix this? Is this a bug? What we want to prevent is having to rerun a Find (or other similar functions) every time a change to the file is made, because this could take a long time and we'd have to sort through the results again.

Any help on this will be greatly appreciated.
Patrik
Posts: 280
Joined: Thu Nov 28, 2013 9:32 am
Location: Hamburg/Germany
Contact:

Re: Editing file will change location in Find results

Post by Patrik »

Hi Ajuan,

I think the problem is that each entry listed in the Results tabs holds its own position (line and column). Now when adding or removing lines, the content below it shifted and the stored positions differ from the actual positions...

A simple workaround would be to process the results list in reverse order, i.e. starting at the last entry. When adding or removing lines there it has no effect to the position of the entries above.

Patrik
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: Editing file will change location in Find results

Post by adrian »

Hello Anne,

Is this in v16.1 of Oxygen (check in Help > About)?
In older versions behavior was different, highlights have not always been updated.

By what means did you run Find All in Oxygen?
Did you use the Find/Replace in Files dialog or the Find/Replace (in editor) dialog?

Note that Find/Replace in Files actually searches the contents saved in the file system, not the contents of the modified editor. This is the reason it prompts you to save all files when searching. This is one possible cause for the found results to get out of sync with the actual contents you see in the editor.
Another known cause is closing a modified editor without saving changes and then reopening it.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
ajuan
Posts: 18
Joined: Fri Mar 27, 2015 8:17 pm

Re: Editing file will change location in Find results

Post by ajuan »

Hi Patrik and Adrian,

Patrik, that's a rather clever workaround. Let me get back to my writer and see if that works for him.

Adrian, thank you for that additional information about File/Replace in Files vs File/Replace dialog. I believe he was using File/Replace dialog, but I have emailed him to double check. As for which version of oXygen, we are on oXygen 16.0 (which we've added some modules to, for our writers).

One of our tools is a custom validation engine that works similar to File/Replace in Files. It is using what is stored in the file system to generate a log report about errors. If a writer fixes one of these errors, it can shift the contents of the file, making the next results not match up to the location reported. Any way to get around this?

Thanks again for your quick response!!

Cheers,
Anne
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: Editing file will change location in Find results

Post by adrian »

Anne,

Apologies for the late reply.
One of our tools is a custom validation engine that works similar to File/Replace in Files. It is using what is stored in the file system to generate a log report about errors. If a writer fixes one of these errors, it can shift the contents of the file, making the next results not match up to the location reported. Any way to get around this?
Unfortunately those error markers are completely static (line and column information). For this I'm afraid there's only the workaround that Patrik suggested (fix the errors starting from the last), or simply invoking the custom validation engine repeatedly, which can be time consuming.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
ajuan
Posts: 18
Joined: Fri Mar 27, 2015 8:17 pm

Re: Editing file will change location in Find results

Post by ajuan »

Hi Adrian,

No worries! Thanks for the confirmation. I think the workaround is working for our writers at the moment, so if there's nothing else I can do about it, then at least we know that.

Thanks again for the help.

Cheers,
Anne
Post Reply