Re: texbuffer

Espen S Johnsen <[email protected]> 05 Sep 2006 16:03:04 +0200
Newsgroups gmane.lisp.clg.devel
Message-ID <[email protected]>
Espen S Johnsen <[email protected]> writes:

> If you want to know the position when the cursor moves, you could
> connect to the signal "mark-set" (I found an error in the definition of
> tree-mark causing a memory fault when accessing the name slot, so you
> need to do an update from CVS to try this):
> 
> (signal-connect buffer 'mark-set
>  #'(lambda (iter mark)
>      (when (and (slot-boundp mark 'name) (string= (text-mark-name mark) "insert"))
>        (do-something-with-current-position iter))))
> 
> Unfortunately the "insert" mark doesn't move when text is inserted so
> you may also have to connect to "insert-text":
> 
> (signal-connect buffer 'insert-text
>  #'(lambda (iter &rest rest)
>      (declare (ignore rest))
>      (do-something-with-current-position iter))
>  :after t)

While extending the text demo to display the cursor position, I noticed
that it may be better to connect the "changed" signal as it is
also invoked when text is deleted.

-- 
Espen

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642