QOwnNotes icon indicating copy to clipboard operation
QOwnNotes copied to clipboard

"Fold" functions for chapter headers (show/hide chapter contents)

Open wolframroesler opened this issue 3 years ago • 9 comments

Suggesting a "fold" function for chapter headers (#, ##, etc.) Display a "-" icon in front of each such header. When the user clicks the "-", the chapter contents (everything up to the next header with fewer or the same number of # characters) is hidden ("fold"), and the "-" icon changes to a "+" icon. When the user clicks the "+" icon, the chapter contents is revealed ("unfold").

Provide "show/hide all" toolbar buttons to fold/unfold all chapters in the current document.

wolframroesler avatar May 04 '21 11:05 wolframroesler

Thank you for your suggestion. Are you speaking of the editor or the preview?

But ether way it would be a huge amount of work. 😁

pbek avatar May 04 '21 12:05 pbek

I mean the editor (didn't know there's a preview) but both would be nice.

wolframroesler avatar May 04 '21 12:05 wolframroesler

That would mean implementing the feature in QTextBrowser and QPainTextEdit, which I doubt will ever happen.

pbek avatar May 04 '21 12:05 pbek

Any chance to do it via a plug-in?

wolframroesler avatar May 04 '21 13:05 wolframroesler

No, the renderers need to be rewritten.

pbek avatar May 04 '21 13:05 pbek

I landed here because I wanted to make the same request.

tomdittrich avatar May 11 '21 14:05 tomdittrich

The text (and source code) editor part of the Qt Creator IDE supports this "fold" function (and it do not depends on KDE). Maybe that can be used instead of the QPainTextEdit. (Qt Creator is licensed under GPLv3, I am not sure about QOwnNotes is GPLv2 only or v2-or-later, they may be incompatible.)

raron avatar Aug 27 '21 06:08 raron

Thank you for your suggestion, but QPainTextEdit is very fast for large plain text files and uses little resources.

pbek avatar Aug 27 '21 07:08 pbek

Opening a file sized ~500 KiB with ~10000 lines increased the used memory by 21 MiB in QOwnNotes, about 25 MiB in QtCreator and 27 MiB in Kate, editing / scrolling were smooth in all of them (on my 8-10 years old PC). Of course this not a proper measurement / test setup, but it could indicate that these programs / solutions may not consume significantly more resources than the simple QPainTextEdit.

raron avatar Aug 27 '21 20:08 raron