Smart cursor, working.

Use a very simple idea, but very nice.
Hope this works without any problem.