improved Caret class
changes in swapLines (now recorded in history)