Page 1 of 1

FR: Code Fold Selected text?

Posted: 01.03.2026 15:24
by sl23
Would it be possible to select some text and Right-Click and have options to fold/unfold the selected sections in full?

Re: FR: Code Fold Selected text?

Posted: 01.03.2026 15:48
by main Alexey
Cmd Palette has command for this: "fold selected lines". it works best when no lexer is active.

Re: FR: Code Fold Selected text?

Posted: 01.03.2026 16:05
by sl23
Ah ok, that's great, I really only need Fold mostly. But would it be possible to have a Toggle Fold command? Just to reduce buttons. Because the toolbar gets overcrowded if you have to have a button to do both things separately.

I don't suppose there's a plugin for adding these to the Editor's Context Menu?

Thank you.

EDIT: Shame, doesn't seem to work for INI files! :(

Re: FR: Code Fold Selected text?

Posted: 01.03.2026 16:25
by main Alexey
Now I see that command 'fold sel lines' is not compatible with tree-helpers like Markdown, Ini files. I will add note in my todo-list for future.


>there's a plugin for adding these to the Editor's Context Menu?

Using the Configure_Menu plugin, you can add commands to the context-menu. See the 'Configure Menu' topic at https://wiki.freepascal.org/CudaText_plugins


>But would it be possible to have a Toggle Fold command?

sorry, no such Toggle command. you need to use another command from Cmd Palette, like 'toggle block at current line' or 'unfold block at current line'.

Re: FR: Code Fold Selected text?

Posted: 01.03.2026 16:42
by sl23
ok, that's great, thanks Alexey! ;)