See http://codemirror.net/doc/manual.html#getLineNumber . Don't duplicate that here.