readline: Put cursor on clicked position

Merged Thomas Bernard requested to merge miniupnp/grafX2:issue103 into master

by default the cursor was always set at the end of the string. Now it is where clicked. see http://pulkomandy.tk/projects/GrafX2/ticket/103