Add function link_errors_to_source setting caret in source from error.

The function adds a click listener to each error cite which sets caret
in the source textarea and scrolls it into view (only when necessary).