NSTextView, NSCenterTextAlignment and trailing spaces
NSTextView, NSCenterTextAlignment and trailing spaces
- Subject: NSTextView, NSCenterTextAlignment and trailing spaces
- From: Tom Waters <email@hidden>
- Date: Thu, 12 Jul 2001 14:32:13 -0700
Has anyone else noticed an odd behavior with centered text in a text
view?
I find that if my text has trailing spaces the text stays centered
around only the visible glyphs.
Here's an example where I'll use asterisks to show where the text view
shows blank space.
[*****h*****]
[****hel****]
[***hello***]
all is correct at this point, but if I type two trailing spaces (shown
as underscores), I would expect this:
[**hello__**]
but it renders like this
[***hello__*]
To make it more clear, if I type two more spaces I get this:
[***hello___]
instead of this:
[*hello____*]
as you can see, it is keeping "hello" centered, ignoring the trailing
spaces.
interestingly, if I then type a visible character, it centers
correctly...
[hello____!]
if I backspace over that single character, the h jumps to the right four
space widths!
I did a simple test of dragging a TextView out in IB and setting it to
be centered, and it seemed to work correctly on the first line, but if
it was wrapping, subsequent lines showed the incorrect behavior...
Is there a setting on NSText or NSTextView to tell it to treat
whitespace characters as contributing to the stringValue's width when it
comes to centering?
or is this a bug?