eteran / nedit-ng

a Qt5 port of the NEdit using modern C++14
GNU General Public License v2.0
94 stars 26 forks source link

Syntax highlighting Pass-2 - different behavior Nedit x Nedit-ng #148

Open jahodb opened 4 years ago

jahodb commented 4 years ago

I am using Nedit 5.6 now. I imported all settings including syntax highlighting by the help of command nedit-import to the Nedit-ng. Usually I use option "Pass-2 (parsing is deferred until text is exposed)" in the definition of patterns. There is different behavior between Nedit 5.6 and Nedit-ng 2019.3/2019.4. Syntax highlighting is not updated after the text modification in Nedit-ng.

I have to switch highlighting off and on again to update it. Is it a bug or an intended feature? Thanks for the reply.

eteran commented 4 years ago

Hmm, sounds like a bug. The rules should behave exactly as they do in NEdit 5.6.

Can you provide your highlight patterns and an example of the syntax which is expected to be highlighted but isn't?

jahodb commented 4 years ago

I sent you the example files via eBox. As the contact e-mail I have used evan.teran@gmail.com. At this email the link for downloading will be sent automatically.Tar file contains:

eteran commented 4 years ago

Thanks, I'll check it out ASAP

eteran commented 4 years ago

So my understanding is that editing the two long lines should toggle the first portion of them to be green background or not based on if they are over 80 chars. Correct?

And that while the patterns seem to match correctly, they don't seem to be updated live?

jahodb commented 4 years ago

Exactly. If the length of the line is greater than 80 characters, the background for the first 80 characters is changed to green and the background of the rest of the line is red - see result_after_loading.png. If I edit the text, the syntax highlighting is updated for edited part of the string only - see result_after_editing.png. If I do the same in NEdit 5.6 the syntax highlighting is updated for the whole line. Thanks

eteran commented 4 years ago

Could you send me (it's easy to attach in here BTW) your classic nedit highlight rules just so it's easier for me to compare behaviors?

eteran commented 4 years ago

So a couple of things:

  1. I manually made the same settings in classic nedit since it wasn't that much :-)

  2. I am seeing what appears to be identical behavior in classic NEdit and NEdit-ng. Are you sure this worked in the original NEdit as you expect?

  3. I agree that it is a bug... but it may be hard to figure out the fix since I was hoping to be able to compare the code paths of the new and old NEdits. If that ends up not being an option, it could prove to be challenging to figure out what's going on here. But I'll do my best. (I've been meaning to rework the highlighting engine entirely anyway, to be honest).

I'll attach a video showing what I mean in a little bit.

eteran commented 4 years ago

simplescreenrecorder-2020-01-22_13 35 20

I really don't see any difference in behavior :-/

jahodb commented 4 years ago

My rc file for NEdit 5.6. is quite complex, therefore I wanted to prepare simpler example (there is added syntax highlighting for the *.inc file only). If I use this setup the NEdit 5.6. behaves like yours in the movie above = highlighting is not updated for the whole line. But if I use my original rc file NEdit behaves correctly in my opinion. Probably there is some other setting, that influences behaviour of the NEdit. I have not found yet, why there is the different behaviour for these two rc files. I attached both files. Thanks.

nedit.rc.zip

jahodb commented 4 years ago

I think I have found it. There is small mistake in the pattern definition in the file nedit.rc_original - the Pattern type: "Pass 1 (applied ...)" is used for the last pattern named "ToFillIn". If I add this definition into file nedit.rc_simpler_examle the behaviour of the NEdit 5.6 is correct. It seems, usage of this single pattern causes update of the highlighting. The same process helps also in case of nedit-ng. If I do this change the highlighting of the file takes longer (example: file size 280MB - original time cca 2 s, new one 5 s). nedit.rc_simpler_examle_corrected.zip

eteran commented 4 years ago

So I I understand correctly, then with that additional pattern, nedit-ng still acts like classic nedit?

jahodb commented 4 years ago

Exactly. The behaviour of both NEdits is the same now. Disadvantage of this "work around" is higher time consumption. I can live with this, but if it is possible to fix it, it would be better :-).

eteran commented 4 years ago

Just updating the category of this issue. It's not technically a bug since we are correctly replicating the behavior of classic nedit... but this should be fixed. So I'm considering it a "major enhancement"