Code folding

Report issues, odd behaviors or submit a detailed bug report.
Post Reply
inspector71
Posts: 126
Joined: 22 Sep 2017 07:59

Code folding

Post by inspector71 » 23 May 2020 05:53

I'm really sorry to keep bringing this up but code folding really does under-perform or fail quite often for me.

FWIW I could almost understand this if it was always in weird files like the Perl-based HTML template files I use with a lot of HTML between curly braces and the like. However, it would seem it's more a case of random 'crashing'. That is, sometimes folding works like a treat on a file from the moment it's opened. Eventually though, at some point I cannot yet determine, it simply breaks for no super-obvious reason. This might be in just one code block, might be throughout the whole file. Sometimes it breaks enough to strip the side bar of all arrows, sometimes not.

It really seems to be quite inconsistent and there's no obvious UI indicating when it happens exactly, or why. If there was some way to help debug it, I'd really like to work with that so I can help you improve it.

There may be some remaining issues with my syntax definitions. How do I ensure that I have reset those to the cleanest current versions? If I open the appropriate folder and delete the files manually from the file system, will RJTE allow me to download new / current versions from Environment, Add-Ons, Highlighters?

ar18
Posts: 60
Joined: 10 Sep 2010 02:43

Re: Code folding

Post by ar18 » 27 May 2020 23:00

I'm seeing the same thing or similar. I have nested nodes that are folded in a function, and as I browse through different nodes elsewhere in code, opening them and closing them, I notice that at some point the code fold icon for the main function I'm working in will have disappeared. I tried "refresh" in the context menu and while that fixes it, it also opens all my nodes and I lose my place. Closing and opening RJTextEd works too, but it is annoying.

inspector71
Posts: 126
Joined: 22 Sep 2017 07:59

Re: Code folding

Post by inspector71 » 28 May 2020 03:33

ar18 wrote:
27 May 2020 23:00
I'm seeing the same thing or similar. I have nested nodes that are folded in a function, and as I browse through different nodes elsewhere in code, opening them and closing them, I notice that at some point the code fold icon for the main function I'm working in will have disappeared. I tried "refresh" in the context menu and while that fixes it, it also opens all my nodes and I lose my place. Closing and opening RJTextEd works too, but it is annoying.
Thanks for writing. If nothing else, it really helps me feel less of a nagging user and less alone, which is important for me in particular. Thanks again!

User avatar
Rickard Johansson
Site Admin
Posts: 5937
Joined: 19 Jul 2006 14:29

Re: Code folding

Post by Rickard Johansson » 29 May 2020 11:15

I'm considering making some changes to the folding code. As of now - it's mostly syntax based. So typing a block comment or string character may disable code folding on all lines below. Once you type an string or comment end character - the folding is restored.

I would like to make the code folding much more independent and not rely so much on the syntax, but more on code indention. One side effect would be that code inside a large comment block can be folded.

It still needs to use syntax in some situations like include the end bracket "}" line when folding, but not in a construct like "} else {".

I'm gonna need some time to make the modifications and test it all, but I'll make the changes in the next release (v14.60).

I think that this will solve many issues with folding.

ar18
Posts: 60
Joined: 10 Sep 2010 02:43

Re: Code folding

Post by ar18 » 29 May 2020 23:27

Just so you know RJ, I have a custom code fold for asm files. The starting chars are ;- and the ending chars are ;:

This has helped me tremendously for reducing the clutter of my code, as there are very few valid directives to fold code with in asm, so whatever I picked had to be "invisible", as would code fold points inside of the comments. My code is now extremely easy to navigate without needing bookmarks or doing searches.

If you need to see my syntax file for this, I can post it.

inspector71
Posts: 126
Joined: 22 Sep 2017 07:59

Re: Code folding

Post by inspector71 » 18 Jun 2020 15:14

Rickard Johansson wrote:
29 May 2020 11:15
I'm considering making some changes to the folding code. As of now - it's mostly syntax based. So typing a block comment or string character may disable code folding on all lines below. Once you type an string or comment end character - the folding is restored.

I would like to make the code folding much more independent and not rely so much on the syntax, but more on code indention. One side effect would be that code inside a large comment block can be folded.

It still needs to use syntax in some situations like include the end bracket "}" line when folding, but not in a construct like "} else {".

I'm gonna need some time to make the modifications and test it all, but I'll make the changes in the next release (v14.60).

I think that this will solve many issues with folding.
This is great to read Rickard. I'm so glad I was not just arbitrarily complaining and hassling you for no good reason.

I hope that the plan you have in mind is not too hard to implement and look forward to helping test or try out the results.

Thanks again for all your efforts. It may be some sort of OCD in me, but I still enjoy the ability to Ctrl + D select. Oh how I wish I had this in my text-fiddling days gone by! Saves so very much effort! I recently discovered an even more impressive aspect to it: once selections are made, somehow it's possible to jump to spaces or (seemingly?) control characters (I'm guessing) further along the lines, even if those characters are not exactly the same columns apart on every line! Not sure I am doing this sensational feature justice here, but just imagine you've got three out of four lines almost identical in columns between selected identical content. But that fourth line contains some text such as a label between two table data tags in html. This fourth label is longer than the rest. Ctrl + right arrow and the selection moves to the start of the close tag on all four lines! Oh well, that's the best I can do for now. It's very cool is the point :)

Post Reply