Re: line folding
rexy712 <[email protected]>
| Newsgroups | gmane.editors.nano.devel |
|---|---|
| Message-ID | <MLMXt1bEgoYqv5JKk7H6OShBCmhWLtyZwhb6XvkXCmq15fg-l4j89oaKyF9sciIRg_Hcv1PynGyZ5YM2aCblI6TK_YXZ4OFoA2AJGZD7W08=@protonmail.com> |
>> * 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-[. The way my implementation works right now is doing exactly this when lines are selected. > But what should M-[ do by default, when nothing is selected and the cursor is on a normal line? What I current have it do is search forward for the next open bracket (whatever is configured as a bracket in nanorc), and make sure it has a matching closing bracket. Then fold all lines between the opening and closing brackets. Then finally place the cursor after the closing bracket. This way you can do a repeated invocation of M-[ and,for example, fold multiple C-style functions back to back. This is the ideal use case for my purposes, but can understand it is rather specific to a certain family of languages. -------- Original Message -------- On Oct 12, 2024, 03:23, Benno Schulenberg wrote: > Op 11-10-2024 om 14:18 schreef Seb: > * 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? 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... What do other folding editors do in such cases? > (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~ Benno