Extra newline between paragraphs of attributed text?

26 views
Skip to first unread message

Winston Wolff

unread,
Feb 4, 2013, 7:11:25 PM2/4/13
to pyglet...@googlegroups.com
I just submitted issue 626. I have attached a patch to fix it, but I wanted to check that we want the behavior I am fixing:
http://code.google.com/p/pyglet/issues/detail?id=626

The problem is trying to get two paragraphs in a RichLabel. The underlying AttributedTextDecoder() has a feature where you can write multiple lines and they are combined into one paragraph. E.g.:
"ONE\nTWO"
is drawn by RichLabel as:
ONE TWO

But two newlines gets interpreted as a paragraph with an extra newline between them, e.g.
"ONE\n\nTWO"
is drawn as:
ONE

TWO

So it is not possible to have two paragraphs without a blank line in between, like:
ONE
TWO

The attached patch fixes this, and also adds a test case. What do you think? I have access to the repo so I can commit it, but I want to check that I'm not misinterpreting how this is supposed to work.

issue_626.patch

Winston Wolff

unread,
Feb 7, 2013, 12:55:20 PM2/7/13
to pyglet...@googlegroups.com
I guess nobody objects if I push this to the repo then?

-Winston
> <issue_626.patch>
>
>

Adam Bark

unread,
Feb 7, 2013, 2:46:39 PM2/7/13
to pyglet...@googlegroups.com
No it sounds good to me.
Thanks.

Alex Holkner

unread,
Feb 7, 2013, 2:53:05 PM2/7/13
to pyglet...@googlegroups.com
I think you can use \\ at the end of a line to introduce a single line break. See the nl_hard1 group in the regex at the top of AttributedTextDecoder.

Alex.
> <issue_626.patch>
> --
> You received this message because you are subscribed to the Google Groups "pyglet-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users...@googlegroups.com.
> To post to this group, send email to pyglet...@googlegroups.com.
> Visit this group at http://groups.google.com/group/pyglet-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
Reply all
Reply to author
Forward
0 new messages