Hi and thanks for this code it is very nice to see how this done.

I wonder if you have noticed that toggling the NSTextView's ruler on and off with setRulerVisible does not work as expected. I don't think it's a bug in your code, I think it is weirdness in how the text view works with the scroll view.

Try toggling the line numbers with e.g. [scriptView setRulerVisible:YES] and NO, respectively. You can turn the line numbers ruler off, but when you turn it back on again, you get *both* horizontal and vertical rulers. This happens even though the code tells the scrollview has no horizontal ruler: [scrollView setHasHorizontalRuler:NO].

Any thoughts on this?

Thanks again and hope you still watch this thread!