NSTextView's -setTextContainerInset: and rightmost ruler margin

  • Hi,

    Either there's a bug in the text system or I'm not doing something right. I'm using NSTextView's -setTextContainerInset: to set margins around my text area. However, this seems to cause a bug in the ruler whereby the tail indent ruler marker (the downward arrow on the right) gets drawn in the wrong place for large margins. This is easy to see:

    1) Create a new project with just a text view in it.
    2) On program start, call

    [textView setTextContainerInset:NSMakeSize(100,100)];
    [textView setRulerVisible:YES];

    You can see how this looks here:

    http://www.literatureandlatte.com/misc/TailIndentBug.jpg

    It seems that the tail indent gets drawn 200 pixels in from the right rather than the 100 pixels that the container inset is set to. You can drag it over to the right again, so the area is still active, it just gets put in the wrong place to begin with.

    So, before I submit a bug report on this, my question is: is there something else I need to do to ensure the ruler works properly when using a text container inset?

    Thanks in advance and all the best,
    Keith
  • On Nov 18, 2008, at 5:05 AM, Keith Blount wrote:

    > Either there's a bug in the text system or I'm not doing something
    > right. I'm using NSTextView's -setTextContainerInset: to set margins
    > around my text area. However, this seems to cause a bug in the ruler
    > whereby the tail indent ruler marker (the downward arrow on the
    > right) gets drawn in the wrong place for large margins. This is easy
    > to see:

    I wonder if this is what the documentation refers to when it says, "It
    is possible to set the text container and view sizes and resizing
    behavior so that the inset cannot be maintained exactly, although the
    text system tries to maintain the inset wherever possible."

    Would it perhaps be better to set the text container size and origin
    directly?