fixes class SmartNewLineCommand

now it should work always (end of file, wrapped header, multi selection)