[Geany-devel] (no subject)

Meyer 3m.meyer at xxxxx
Thu Dec 1 23:54:00 UTC 2011


Sure.  I want to be able to select text, and then insert a character (e.g.
an apostrophe) before and after the selection just by pressing the
apostrophe key.  Since the normal behavior when a character is pressed
while text is selected is to delete the text and insert a character, I need
to know when that happens - then I could undo the delete and insert my
characters.  If it was two separate events though - delete then insert - I
won't want to do anything.

I have it working now, but it seems awfully hackish:  when one of the
characters I might insert is pressed, I store the current position of the
cursor and undo the last event.  If the new cursor position is the same
place as the old one, then it was a "overwrite" event.  Otherwise, it was
delete then insert.

So, any ideas for how I could do this would be much appreciated!

Alex

On Thu, Dec 1, 2011 at 3:40 PM, Frank Lanitz <frank at frank.uvena.de> wrote:

> Am 01.12.2011 20:57, schrieb Meyer:
> > I have two possible situations that I need to differentiate between, and
> > I'm not sure how to do it - The first situation is the user deletes
> > selected text by overwriting it with a new character.  The second is the
> > user deletes selected text by pressing backspace/delete, and then enters
> > a new character.  I thought this would be fairly easy, but I've been
> > trying to figure it out for awhile and haven't gotten anywhere. Does
> > anyone have any ideas for how I could accomplish this?
>
> Can you go into more details in which context you need that information?
>
> Cheers,
> Frank
>
>
>
> _______________________________________________
> Geany-devel mailing list
> Geany-devel at uvena.de
> https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geany.org/pipermail/devel/attachments/20111201/4719a027/attachment.html>


More information about the Devel mailing list