view: add method to vertically align the caret line

(integrated from trunk branch change 94a0391 by Todd Whiteman <toddw@activestate.com>)