Re: line folding
rexy712 <[email protected]>
| Newsgroups | gmane.editors.nano.devel |
|---|---|
| Message-ID | <Zf1KY0OLTq1Kn5lK1fJIkF3__oMvOEYsNzO9xi8FncZxbi9-NfOar-S62-msQTtpNYOXRUrz5dVja3dX6TlDTa-5vPwiGXPGB1cNKuvDZUA=@protonmail.com> |
> * ...and if lines have been folded, go to the next group of folded lines? I like this if we don't want a default action of performing some kind of automatic fold. This also made me realize that I should have been more detailed in my response to how my implementation currently works. If no lines are selected and the current line is folded, it unfolds. Otherwise, if no lines are selected, it will search downward for either the next folded line or the next open bracket, whichever occurs first. If it finds a bracket, it searches for the matching closing bracket, then it folds all lines between them. If it finds a folded line, it unfolds that segment. If neither is found, it prints an error that no automatic fold could be performed. > I'm afraid that might be terrifying for some users, watching their lines "disappear" because they've pressed the wrong key. Perhaps it would be one step too far in the "power user" direction. I don't think it's really a problem. There are plenty of commands that I accidentally did in nano that were more problematic and made me 'terrified'. Hard line breaks was one that got me when I was just starting using nano. Folding at least is ephemeral and doesn't change the content of the document at all. And it does display a clear message of '---X lines folded---' in place where the fold happens. -------- Original Message -------- On Oct 14, 2024, 05:10, Seb wrote: > Hi Benno, >> * I select some lines of text with Shift+Arrow key. >> >> * I then press M-[ to visually replace the selected (complete) lines by a >> single line which may for instance look something like >> ====> (folded lines 237 to 274) > >> * To unfold the lines, I place the cursor on the line above and press M-[. > > Right -- when a region is selected, or when the cursor is on a folded > part, it is quite obvious what M-[ should do. But what should M-[ do by > default, when nothing is selected and the cursor is on a normal line? Perhaps the same thing as Alt+PageUp/Down does for anchors? If nothing is selected... * ...and no group of lines has been folded, display the message... [ There are no folded lines; to fold lines, first select them ] * ...and if lines have been folded, go to the next group of folded lines? > Having no experience with line folding, I would expect M-[ to do some > default folding action, for example: from the current line until the > next blank line, or: when the cursor is somewhere in a block (delimited > by blank lines), to fold that block... I'm afraid that might be terrifying for some users, watching their lines "disappear" because they've pressed the wrong key. Perhaps it would be one step too far in the "power user" direction. >> (As an aside: why doesn't Shift+PageUp/Down select lines too (Nano 7.2)?) > That's because you're using urxvt and urxvt produces strange, > non-conforming escape sequences for modified movement keys. Add the > following two lines to your ~/.Xresources file, restart, and the > mentioned keystrokes should work: > URxvt.keysym.S-Page_Up: \033[5;2~ > URxvt.keysym.S-Page_Down: \033[6;2~ Thanks! But I'm afraid this time it didn't work. Shift+PageUp shows me the lines that the terminal displayed before I opened Nano. Sébastien.