A lot of dirty hacks to make textbox cursor working.