[squeak-dev] Re: Re: Re: A better looking text caret (IMO)

Andrew Tween amtween at hotmail.com
Mon Feb 25 20:14:31 UTC 2008


Hi,
"Igor Stasenko" <siguctua at gmail.com> wrote in message 
news:4a5f5f320802251124g41320948sb44ab34d750865fa at mail.gmail.com...
> Andrew,
>
> i propose to change TextMorph>>#step method to following:
>
> step
> (paragraph notNil and:[paragraph focused])
> ifTrue:[
> paragraph toggleCaretBlinkShow.
>                        self invalidRect: self caretRect
> ]
>
>
> and new method #caretRect should return a bounds which currently
> occupied by caret.
> Then, hopefully, textmorph will redraw only single line each step, not
> everything visible on it.
>
> The problem is with determining this rect..
> An easy way can be to add an ivar (caretRect) and update it during
> selection change or during textmorph redraw.

I'd do the easy way.
Where were you planning on adding the ivar? In NewParagraph ?

> Or.. if there are way to determine these bounds with short
> calculation, then we don't need adding ivar.
>
> Have any ideas, how #caretRect should look like?

Just gets the caretRect ivar value from paragraph?
With caretRect set by the paragraph whenever it draws the caret.
I don't know if the co-ordinate system of TextMorph and NewParagraph will 
always be the same.
I think there is a Canvas in the middle. And what about margins, rotation 
etc.?
Try it and see.

Cheers,
Andy

>
> -- 
> Best regards,
> Igor Stasenko AKA sig.
>
> 





More information about the Squeak-dev mailing list