Improve line click handling