[scribus-dev] Proper fix for "cursor blink crash"/"invisible cursor" dilemma

Elvis Stansvik elvstone at gmail.com
Thu Aug 18 20:45:06 UTC 2011


2011/8/18 Elvis Stansvik <elvstone at gmail.com>:
> Hello again,
>
> Perhaps a slightly trickier question this time.
>
> In the regular edit mode there's currently a "fix" for a crash that
> happens when it is trying to draw the blinking cursor of a text frame
> that has only one row of text and which has overflowed.
>
> You can see it in CanvasMode_Edit::drawTextCursor(...):
>
>  209         //CB: If we have this test in we get no initial cursor
> placed for a new text frame
>  210         // but if we do, we crash when we resize.. #9886
>  211         if(textframe->lastInFrame() < 0)
>  212                 return;
>
> lastInFrame() < 0 happens when there is no text in the frame.
>
> I've duplicated this fix in my code, since I hit the same crash.
>
> Does anyone know what a proper fix would be? Because currently this
> means that the cursor is initially invisible when activating a cell.
> It won't be visible until you start typing :/
>
> Should lastInFrame() really be allowed to return < 0 values?
>
> Hoping that there's a better way to fix this, since it's kind of a
> bummer when you're navigating empty cells in a table --- you can't see
> where you are.

Ok, so I seem to have found a solution to this. See the attached diff,
which I've also pushed to my table repo.

Vox, do you agree with this fix?

The cursor position calculations seems to still work, no crash, and
the cursor is painted on initial edit mode activation, even on empty
frames.

Regards,
Elvis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-crash-or-invisible-cursor-dilemma.diff
Type: text/x-patch
Size: 3257 bytes
Desc: not available
URL: <http://lists.scribus.net/pipermail/scribus-dev/attachments/20110818/e8955849/attachment.bin>


More information about the scribus-dev mailing list