[wx-dev] wxRichTextCtrl newline linking bug
Tom Gersic
wxdev at teleologic.net
Thu Jan 25 11:47:34 PST 2007
Julian,
Well, I'm not sure, but I think the problem might lie around line 4877
of richtextbuffer.cpp. If a paragraph style isn't found at line 4854, it
still seems to try to find any style at line 4877, and then there's this
block that eliminates "character styles", but wxTEXT_ATTR_URL isn't
included in the list:
// Eliminate character styles
flags &= ( (~ wxTEXT_ATTR_FONT) |
(~ wxTEXT_ATTR_TEXT_COLOUR) |
(~ wxTEXT_ATTR_BACKGROUND_COLOUR) );
However, neither adding wxTEXT_ATTR_URL to the list nor commenting out
the entire if (!foundAttributes){} block seems to solve the problem. I'm
not sure, because changing
wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE to
wxRICHTEXT_INSERT_NONE doesn't seem to make much of a difference either.
So maybe that has nothing to do with the problem...
If you'd like to see this problem in action, you can see it in the
wxRichTextCtrl demo/sample application. All you have to do is run it,
and then add a newline after the linked text at the bottom of the
paragraph ("The wxWidgets Web Site").
Thanks,
Tom
Julian Smart wrote:
> Hi Tom,
>
> Tom Gersic wrote:
>> Julian,
>>
>> I just noticed that when text is linked prior to a newline, that
>> newline takes on the link properties of the text that precedes it,
>> even if it hasn't specifically been set to a link style. I imagine
>> this has something to do with the fact that the link is extending to
>> the far right side of the control...Adding a space in front of the
>> newline will fix the problem, but this solution isn't particularly
>> feasible in my application. Since a newline probably doesn't really
>> need to have any sort of style information, is there a way to always
>> cause newlines to respond to GetStyle as a normal, non-linked style,
>> or HasFlag as false?
>
> wxRichTextCtrl::OnChar calls wxRichTextBuffer::InsertNewlineWithUndo
> with the flag wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE so it's
> supposed to inherit the previous paragraph style, but not I think the
> character style (except for whatever default style might be active).
> So maybe you could have a go at stepping through this in your debugger
> to check what's going wrong...
>
> Best regards,
>
> Julian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-dev-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wx-dev-help at lists.wxwidgets.org
>
More information about the wx-dev
mailing list