Big refactor of the mouse handling code in term.ts.
Big refactor of the mouse handling code in term.ts.

sedwards2009/extraterm,sedwards2009/extraterm,sedwards2009/extraterm,sedwards2009/extraterm,sedwards2009/extraterm