If you must manually draw things, you'd need to make sure your NSTextView subviews are inset properly so as to not overlap the border's area. But how you'd mimic the drawing that NSBox/NSScrollView does, I do not know.