[Geany-devel] Multi-Edit for geany...

Jimmy Paillet jimmy.paillet at xxxxx
Sun May 10 11:58:30 UTC 2009


Hi all,
Had spare time this week end, so I started working on a little project...
If some of you use Gedit on Linux, Textmate on Mac, or E texteditor on Win,
you may be familiar with the concept of multi-edit....
if not check this video:
http://media.jon-walsh.com/content/journal/pages/multi-edit/demo.ogv (made
the author of the Multi-edit plugin for gedit)

it's one the feature of gedit that really DO save me some time...very nice
for small refractoring...

the closest thing approaching in Geany (and basically all scintilla-based
stuff I believe...) is the zero-width rectangular selection...
you'll find a patch for editor.c for an embryonic start on this....
the code is awful I reckon...just a draft...
the idea behind it is:
you click somewhere you want to edit...
a subsequent Control+Atl+click somewhere will start a multi edit session...
and keep storing these positions...
if you add a char, and multi edit is on, it will appear to all positions
stored before (this is happening is on_char_added)
if you delete, it was a bit more complicated as handling the message
SCN_MODIFIED gave weird result....so basically i added a
callback on the delete key...that will call on_char_deleted....deleting at
all mult edit positions...

a regular click will cancel the multi edit session...

for the moment I only implemented the case where multi edit positions are
below the first editing positions (adding and deleting are moving positions
around...and it's not easy to keep track of these movements...)
there is no indicators showing the other editing positions...(trying to find
how to change locally the background of the editor)
I need to implement more protections (ex: for exemple, if you change the
document with keyboard shortchuts, and dont click anywhere at all, multi
edit is not erased, causing pb)
would probably nice to implement to start a session without mouse...
refine the whole thing to sum up :D....

you can try it out nevertheless and point out what i missed
jimmy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geany.org/pipermail/devel/attachments/20090510/8e9e23f5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: editor.patch
Type: text/x-patch
Size: 6308 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20090510/8e9e23f5/attachment.bin>


More information about the Devel mailing list