I've been searching for vertical editing sequential numbering, I've found: https://www.emeditor.com/text-editor-features/coding/multiple-selection-edit...
On vertical selection, a menu option allows for sequential numbering to be inserted. This would be a welcome addition to Geany. It probably would be best/proper to add it to Scintilla but it could probably be added to Geany by cycling over the vertical selections or prior to paste. ![geany_feat](https://user-images.githubusercontent.com/10157303/65474182-e2776d80-de48-11...)
This feature is also available in Visual Studio via extension: ![demo](https://user-images.githubusercontent.com/10157303/65512377-13868b00-dea7-11...) https://marketplace.visualstudio.com/items?itemName=albymor.increment-select... https://github.com/albymor/Increment-Selection
Sublime also has Increment Selection - I guess that's what it should be called?? - available via the Increment Selection package: ![9kBFH](https://user-images.githubusercontent.com/10157303/65513663-a9bbb080-dea9-11...) https://stackoverflow.com/questions/14640093/how-to-insert-a-column-of-incre... https://packagecontrol.io/packages/Increment%20Selection
@AdamDanischewski: thanks, I think we have enough information :smile: IMHO this can be implemented in a new plugin or maybe better as an extension of the Line-Operations plugin.
It should be possible to configure a *Format->Send selection to* command with awk to do this. Although Windows users won't have awk (perhaps we could bundle it if small enough). Also perhaps some preset awk commands with meaningful labels would help.
@LarsGit223 Lol, when it rains it pours! I couldn't find anything nor common terminology so I thought I'd save others the trouble after stumbling onto other implementations.
@ntrel I've tried using the Send Selection To --> <User Command> interface but it doesn't paste back across the vertical selection. It pastes starting at the last selected line in the vertical selection (Geany 1.36). If that were fixed it may be possible to use that mechanism - though it'd probably be faster if implemented internally.
As an alternative to the possible feature name _"Increment selection"_ I suggest _"Enumerate selection"_.
Maybe you can check [Geanyinsertnum](https://plugins.geany.org/geanyinsertnum.html) plugin.
@intact: ooops, of course. Did totally oversee that.
@intact Yep yep! That plugin does the job - thanks! I didn't notice it for some reason.
If you are running Geany 1.36 you can add them by: ``` $> git clone https://github.com/geany/geany-plugins.git $> ./autogen.sh $> ./configure $> make $> mkdir mylib; find . -type f -name '*.so' -exec cp {} mylib/ ;
``` Then in Geany, add the plugin path: Edit->Preferences->Extra Plugin Path (add /path/to/mylib).
@LarsGit223 If you look at the plugin there looks like there is unfinished implementation of incrementing letters too. That would probably come in handy from time to time, so maybe keeping it flexibly named with "Increment" vs enumerate would be easier over the long haul.
Closed #2317.
I've tried using the Send Selection To --> interface but it doesn't paste back across the vertical selection.
@AdamDanischewski if you have time, could you file this as a separate issue please? Note the manual calls 'vertical selection' rectangular selection.
I've tried using the Send Selection To --> interface but it doesn't paste back across the vertical selection.
Yep thats known behaviour see also #625 #841 #850 #1083 several of which were opened by or commented on by one@AdamDanischewski (mentioning no names :)
This whole thing will need to be examined if Geany ever moves to Scintilla 4 where rectangular selections have become multi-selections if I remember the Scintilla ML discussion correctly.
Ok, thanks Lex
@elextr actually those issues are about pasting, not about Send selection to. Surely that's a separate issue?
`Send selection to` pastes its result into the selection, thats why its the same issue.
To expand, basically its the Scintilla paste into rectangular selections default behaviour. Scintilla does have another option SCI_MULTI_PASTE to do it differently, but I'm not sure how much use it would be in this use-case.
@ntrel Yea, I played around with it before and it's expected behavior. I kind of think multi-paste should work the way @Akronix mentioned in #850. If you have one line and then make a vertical selection (rectangular selection) that it multi-pastes across the entire selection but there's still some debate about it. Maybe a vote would help?
I still strongly think that a single-line copy should paste repeatedly in as many lines selected as they are. That's why you did the multi-line selection after copying and that's the quickest way to append certain text to lines that are similar in structure (like tabular data for instance). I think this would make the multi-line selection much more useful, at least for me. Another good point to make it work this way is that it would be consistent with the behaviour of many other popular editors.
Voting? Why is it that everyone wants to cut off an option thats useful in some situations in favour of an option thats useful in others, as I said on #850 why not have __BOTH__ and which is default can be set from an option.
[start rant] I'm getting sick of people who assert that their preferred way is the only way of doing something and all other ways must be suppressed because _they_ want it that way or because some other tool does it that way. It feels like every second pull request is to drop something useful in some use cases and replace it with something thats useful in a _different_ set of use-cases. Somebody always has to lose. Folks lets try adding value here, not slicing it ever thinner so the tools are only useful for a small for a narrower and narrower user space. [end rant, sorry @AdamDanischewski to hijack your PR]
@Akronix I agree with your sentiments on this. @elextr I would be fine with there being an option for it.
Perhaps it could be the default provided no one can give a better use case for it not being. To only paste one line when a vertical multiple line selection/rectangular selection were held on prior to pasting seems to imply that a user error is being corrected since it ignores the additional user efforts.
@AdamDanischewski in this case you don't need an option, just put both items in the menu, and make both keybindable and bind one or both by default.
But note that I doubt that multipaste will help with pasting the output of `send selection to` since it would paste the multiple lines on every line I think (unless somebody checks Scintilla code or tries it and finds its different). There doesn't seem to be a way of telling Scintilla that the paste is a rectangular select, it says "Rectangular selections are handled as multiple selections although the original rectangular range is remembered so that subsequent operations may be handled differently for rectangular selections" and "pasting a rectangular selection places each piece in a vertical column." meaning the "rectangularness" is remembered internally to Scintilla somehow and is unlikely to be a property of the results of `send to selection`?
Note, beware that most of the Scintilla multiple selection documents section is only for Scintilla 4, which Geany does not use, and which could allow the whole area of rectangular/multiple selections and pastes to be re-assessed.
Ok @elextr you talked me into looking into the code finally. I've got it working with the current Scintilla. ### line 167 geany/scintilla/src/Editor.cxx: **from** `multiPasteMode = SC_MULTIPASTE_ONCE;` **to** `multiPasteMode = SC_MULTIPASTE_EACH;` ![vertical_paste_fix](https://user-images.githubusercontent.com/10157303/65728722-cdd5e800-e089-11...)
Ok @elextr you talked me into looking into the code finally.
Heh, I wasn't actually trying to do that, but while you are there, "just" a menu item and keybinding to go. :grin:
I was actually trying to suggest to be patient until the Scintilla 4 upgrade, the "it needs c++17" excuse is getting thinner by the day, will have to happen soon :smile:
github-comments@lists.geany.org