[Geany-devel] Geany multicursors patch

Davide Andreoli dave at xxxxx
Wed May 23 19:19:45 UTC 2012


2012/5/23 Lex Trotman <elextr at gmail.com>:
> On 23 May 2012 04:40, Davide Andreoli <dave at gurumeditation.it> wrote:
>> 2012/5/21 Dimitar Zhekov <dimitar.zhekov at gmail.com>
>>>
>>> On Sun, 20 May 2012 12:30:12 +0200
>>> Davide Andreoli <dave at gurumeditation.it> wrote:
>>>
>>> > Hi all!
>>>
>>> Hi.
>>>
>>> > I implemented this in editor.c (and not as an external plugin) because I
>>> > have plans to also extend the snippets to support multi editing.
>>> >
>>> > Actually the patch is really simple but is just a first test, it is not
>>> > ready as there are 3 open issue:
>>> >
>>> > 1. do you like the feature? :)
>>>
>>> Yes, but would prefer it as a plugin. Extending it to snippets, well...
>>> doesn't seem useful to me.
>>
>>
>> Please, give a look at the last mail (the one I replayed) in the geany ml,
>> it seems I'm not the only one searching for snippets that can insert the
>> same typed word in different position inside the snip.
>>
> [...]
>
> So Davide, lets see how complex the snippet changes are going to be.
> If they are small they can probably go in core, otherwise for a
> function that has an uncommon use-case it should be a plugin as
> Dimitar suggests.

Ok, I also finished the snippets part, super-easy at the end :)
you can find my new 'supersnip' branch at:
https://github.com/DaveMDS/geany/tree/supersnip
also included the multicursor 3 lines (needed)

Here you can read the description, one example and
the commit diff for the "super snippets" patch:
https://github.com/DaveMDS/geany/commit/c7035d58f2b8b50df96e9cd9fbf6f9e73ec2ce74

I think also this one is small enough for the core...29 lines :)


>
> IMHO the multiselection is now small enough (3 lines)  that a plugin
> would be overkill :)
>
> Davide, what is the impact of enabling this, how do existing features
> interact with multiple selections? Do any Geany actions that use
> selections fail when fed a multi-selection? How does paste work? And
> what if I actually select some text (ie ctrl-swipe not just click).

I did not found any regression nor any strangeness or conflict yet.
Yes, you can make real multiple selections (Ctrl+Alt+Drag) and the behavior
is quite always the expected: 'copy' while multiple selection active will
put in the clipboard all the selected text merged, 'paste' instead will only
paste at the primary selection, 'typing' with multiple selection will do the
same as a single selection (selected text cleared). All other commands
should always work normally on the primary selection(the last one done).



>
> You *must* update the documentation to match, making sure you catch
> all places where such a change might impact.

sure! doc will be my last commit before the pull request


>>
>>>
>>>
> [...]
>> The multiple selection hard-coded binding (Ctrl+Alt) is "shadowed" by the
>> rectangular selection
>> binding (Ctrl). So the only way I found to make multiple selection +
>> rectangular selection to work
>> is to change the binding for the rect selection.
>>
>> With the patch applied you can make rectangular selection with "Super" and
>> multiple selections with "Ctrl+Alt".
>>
>> Probably you will not like the binding change (I don't like to change it,
>> I'm quite used to use Ctr for rect selections)  so I'm searching another way
>> to solve the binding conflict... suggestions are welcome
>
> As a GTK app Geany normally tries to follow the Gnome HIG
> http://developer.gnome.org/hig-book/2.32/hig-book.html#input-mouse
> section 10.1.2.
>
> This specifies ctrl-click as the extend selection input, and it is in
> the majority of applications.  So despite it having been a Geany
> setting for a long while, I think it should be changed now that
> multiple selection is going to be supported.
>
> Any suggestions for a replacement for the go to definition binding?

this binding issue is driving me crazy!!
I don't have a good solution :/
The situation is:

Ctrl+Alt+click(or drag) -> multiple selections (badly hardcoded in scintilla)
Ctrl+click -> goto definition

the bind for rectangular selection is strange (at least on my Linux Mint+E17
environment), should be Ctrl+drag, but I can make rect selection only
with Ctr+Alt+drag :/
This key can be changed in scintilla with the api:
SSM(sci, SCI_SETRECTANGULARSELECTIONMODIFIER, SCMOD_SUPER, 0);
SCMOD can be CTRL, ALT or SUPER

the only way I found to make both rectangular and multiple selections, is to set
multiple to Super and thus:

Ctrl+Alt+click(or drag)  ->  multiple selections
Ctrl+click  ->  goto definition
Super+drag  ->  rectangular selection

I don't like to use the Super key, and also smell some possible platform
difference around.


btw, thanks for taking the time to follow this issue...and
give a try at the 'supersnip' branch, it's amazing!  :D

davemds



>
> [...]
>
> Cheers
> Lex
> _______________________________________________
> Geany-devel mailing list
> Geany-devel at uvena.de
> https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel



More information about the Devel mailing list