I'm not sure how to 'vote' this suggestion up so I'll just add a reply. Just about all of the options above would work for me. Shouldn't this be a relatively simple solution to put in as it seems most text editors have this functionality built-in already?
Anyway... One Vote Up from me!