giuspen / cherrytree

cherrytree
https://www.giuspen.net/cherrytree/
Other
3.38k stars 461 forks source link

Collapsable headers please! [feature request] #2389

Open RFImages opened 10 months ago

RFImages commented 10 months ago

Hi I had previously made a request for collapsable text sections in the body of a node or subnode, similar to the way you collapse nodes and subnodes in the node/subnode pane.

Recently I discovered by accident that Microsoft Word already has this feature so I am using it to edit LONG subnode bodies, then having to copy it back to Cherry tree: https://support.microsoft.com/en-us/office/collapse-or-expand-parts-of-a-document-701786e0-95e2-40bf-bfe5-f0233cd3520c

The way they do it is perfect, just identifiy heading lines (h1, h2, h3 as you already do), then when hovering over the heading, an arrow appears on the left that can be clicked to collapse or expand the body below tcontained within that heading.

This is SOO helpful for super long text nodes, to be able to focus on the area of interest without all the clutter of the rest of the text body. It is so useful that I am willing to donate a downpayment of $50 if you also think it is a feature worth implementing, and then larger donation on completion, depending on how well done and how soon. What do you say Giuspen? I needed this yesterday as I strugggle daily with a particularly long To Do list in my todo node and I don't want to have multiple subnodes just to maintain a heirarchy (too many clicks, too time consuming

RFImages commented 10 months ago

ok to get attention I will up my bid to $75, payable immediately upon acknowlegement of this feature request and an estimation of when it will be available. When implemented I will donate significantly more! Yes, I am bribing you! The utility of this feature is enormous for me, and I assume others, since Microsoft saw fit to incorporate it into Word.

RFImages commented 9 months ago

:(

giuspen commented 9 months ago

Hi @RFImages don't be sad it's difficult for me to follow all the issues I'm only one :) In fact I apologise to who doesn't receive an answer and feels ignored, I hate that but believe me I become crazy if I follow everything and I fail to focus on a development feature. I will have a look after v1.0.3 but before this I need to implement virtual nodes.

RFImages commented 9 months ago

:) Ok cool, I understand you are packed with work on this great product. As promised I will now donate $75 on good faith. What are virtual nodes?

giuspen commented 9 months ago

Thank you my friend :) Virtual nodes are a group of node "views" that point to only one node content, so you can see and edit from all the nodes scattered in the tree that belong to that group. Not sure if there's a better way to call them, I'm still thinking and open to suggestions.

RFImages commented 9 months ago

It may not be $75 considering various sources for exchange rates, but will make it up to you generously when this feature is incorporated. Thanks for considering it. Others have asked for it as well. Keep me informed!

RFImages commented 9 months ago

Not sure I understand the Node thing, or it's usefulness is there a post where I can read about it?

giuspen commented 9 months ago

It's discussed here https://github.com/giuspen/cherrytree/issues/1222 and has been requested time ago privately from one of the few supporters that have a recurring monthly donations, I cannot make him wait any longer

RFImages commented 9 months ago

Oh no I understand I am not asking that, I am just curious about what virtual nodes are. Thanks for the link.

RFImages commented 9 months ago

Ok I think understand it now and yes I agree that would be useful. I will comment in the other post.

RFImages commented 6 months ago

This got off topic, but wondering where the collapsible header feature might be in the queue? I am noting other similar requests here

[Collapse, Expand Text Selection · Issue #2026 · giuspen/cherrytree (github.com)] (https://github.com/giuspen/cherrytree/issues/2026)_

Collapsable Text Selections · Issue #2360 · giuspen/cherrytree (github.com)

giuspen commented 6 months ago

Hi @RFImages I didn't forget about this, I am still to release a bugfix version v1.1.2 today or tomorrow related to the search, then I will be off until half of April without a computer, only phone, and then I will start looking into this.

RFImages commented 6 months ago

Thank you @giuspen You mean you can't develop software on a phone? haha Come to think of it, being able to view cherrytree on android would be great! How will you view your personal cherrytree? Safe travels to the desert island!

giuspen commented 3 months ago

Hey @RFImages I haven't found yet a way to hide part of the GTK text view in order to achieve the result using the gtk3 library interface. One quick but not as good possibility would be to allow the so called code boxes to collapse. A code box though can currently contain only plain text (this may change in future where I will try to support rich text too) So basically you would place your header and below a code box with plain text that can collapse and will remember the collapsed status. Let me know if this may help your workflow or not.

giuspen commented 3 months ago

Interesting just after writing to you I found https://github.com/aeischeid/gedit-folding it looks like it is possible to hide sections of text using text tags, I'll investigate further

RFImages commented 3 months ago

I am so happy to see this get attention! Especially since I just started a new job and it will be a huge help in keeping me organized and efficient. Thanks for remembering, great timing. I just sent a donation 25 to keep you motivated. Paypal would not let me make it monthly for some reason but I will make this recurring. The code box solution does not help much because all of my text body is highly formatted. I hope that the text tags work!

giuspen commented 3 months ago

Many thanks for your donation @RFImages ! I will complete first the auto/guided recovery of corrupted documents from the most recent backups and then I am on this. I now know that the library supports what I need and I have a plan so I don't expect problems. I will update this ticket soon with likely a version for you to try.

RFImages commented 3 months ago

Beautiful! Do you think it will work with the headers as the collapse/expand point similar to the way Word handles it? Also I am always afraid to upgrade for fear of my version 1.0.0 .ctz file being corrupted by the newer version. Is my fear unfounded?

giuspen commented 3 months ago

Yes the idea is to improve the current parser that adds an anchor before every header when generating the TOC so that these anchors will be clickable and capable of hiding/showing the text under the header (up to the next header of the same level). Theoretically the current stable version v1.1.3 is the safest ever as I'm constantly trying to make it more and more robust, but it is certainly good to save a time based backup from time to time. I have always done it even though have never needed one.

giuspen commented 3 months ago

In case of a collapsed header, if you close and reopen cherrytree would you expect the header to be still collapsed or expanded?

RFImages commented 3 months ago

I think I would prefer it were left in the state it last was when saved (collapsed). If that's too hard I prefer it open collapsed. A collapse all/expand all option would be nice.

RFImages commented 3 months ago

I just had a thought I wonder how this would affect the search function. If the word is found within a header would it have to expand that header?

RFImages commented 1 month ago

Hello @giuspen It has been a couple of months and I am wondering, 1) Are you ok? if (you are ok) then Is this still in progress? ; elseif (you have had time) {Are there obstacles? ; Is it very time consuming and not enough time has elapsed?} elseif (not done) I understand, I just hope this doesn't get pushed too far on the back burner. I have need of it every day! ; else I am ready to make monthly contributions! ; else Thoughts and prayers!

I thought I would ask this in language you understand ;) Feel free to correct my psuedo code syntax. Hard to believe github does not allow indentation!

giuspen commented 1 month ago

Hey @RFImages no problema just some much needed holidays. I have started looking at this and will propose a first version soon. Likely the first version will not remember collapsed/expanded status.

RFImages commented 1 month ago

Great glad you got some time to refresh! I would be happy to test a handicapped first version. @giuspen

DiagonalArg commented 1 month ago

I'd also be interested in this. Having used org-mode in emacs, I'd suggest to consider what happens when we do a search. In org-mode, when we do a progressive search, the subsection opens at the identified string/regexp, and then closes when we move to the next in the progressive search. It only stays open if we begin editing there.

So, perhaps you'd want to open the drop-down when we click on one find in the search box, and then close that/ open the next when we click on that.

I hope I've explained that clearly enough.

And @giuspen / you've been quite the trooper all these years. It's been a while since I've checked in here, but you were always remarkably responsive. Back when you were working on markdown/ pandoc/ lua etc., you have someone working with you. I'm sorry to hear you're on your own now. :heart:

RFImages commented 1 month ago

Agree, @giuspen is an example of what any software developer should be. As a solo act his support far exceeds that of very large software companies who don't care a whit about the user, even after charging ridiculous subscription prices. With this feature I intend to support him with a regular donation. I hope other users will choose to do the same.

giuspen commented 2 weeks ago

I'm almost there, I will be able to propose a first version as a matter of days. The direction I'm taking is to remember the expanded/collapsed status between sessions. About the search that auto expands and then collapses again, it makes sense but please be patient that may come afterwards and not straight away.

RFImages commented 2 weeks ago

Thank you! I sent another donation today.

giuspen commented 2 weeks ago

Thanks @RFImages that's very generous of you!

giuspen commented 1 week ago

First version (1.1.4+25) is available to try at https://www.giuspen.net/cherrytree/#testing Please test it and provide feedback NOTE: you have to generate the so called TOC to see it in action. After generating/re-generating the TOC you will see small clickable eye closed/open icons near the headers

RFImages commented 1 week ago

I am not sure how to test this, I downloaded the cherrytree_1.1.4.0+25_win64_portable.7z archive and installed and the "about" says 1.1.4 (nothing about +25) as it did before installing this.

How are collapsible headers exercised? How do you generate the TOC?

giuspen commented 1 week ago

Hey @RFImages for now in order to turn the headers into collapsible, you have to insert a TableOfContents. For example you can create a new rich text node in the tree and then Insert->Toc and Headers Collapsors Then go back visit your headers, you will see a trailing icon that you can click to Collapse/Expand

RFImages commented 11 hours ago

Hmm I am only seeing a trailing anchor , and nothing with 1.1.4 (nothing about +25) in the about:1.1.4 (nothing about +25)

From Luis and From Richard are H1 headers

Screenshot 2024-10-03 104926
giuspen commented 8 hours ago

Hey @RFImages I'm running a bit late so I will release v1.2.0 shortly and you can give me feedback trying the official version

RFImages commented 8 hours ago

My preliminary feedback is that inserting a global TOC appears to need to place an anchor on every line throughout the file, which I don't think is useful and adds clutter. Is there a way to at least limit that to Header lines? Also wonder what happens if I need to add a new header, would I need to regenerate the TOC each time I add a new header?

giuspen commented 7 hours ago

The anchors are added only on the line of the headers. image

RFImages commented 4 hours ago

Well that looks very great! What I meant was the anchors you get when you "insert anchor":

image

Maybe I am using TOC wrong, I never use it but when I did it placed an anchor at the end of every line in my file. Perhaps because I selected "All the tree " when I did Insert TOC? It looks to me that the open eyeball means collapsed and the crossed out eyeball means expanded? Intuitively I would think the opposite - Open eyeball means open header for viewing? But I will wait to test it.