I am building an editor for the web in Javascript. I need to force an action on a selection. This selectin may not have been made though e.g. you can select indent on highlighted code and just that gets highlighted, but if u press indent and no code is highlighted it should still ident the entire line. I need to be able to create a selection of the whole line iof there currently is no selection. i have managed to determine there is no selection, but i dont know how to then go and create a selection of the line we are currently on.

Anyone got any ideas?