protected void UpdateCommandState(ViewState stateToUpdate) {
     if (caretViewReader.CaretPosition.Line >= 0) {
         stateToUpdate.LineCount = textViewReader.LinesCount;
         stateToUpdate.ActiveLineIndex = caretViewReader.CaretPosition.Line;
         stateToUpdate.ActiveColumnIndex = caretViewReader.CaretPosition.Column;
         stateToUpdate.LineStates[caretViewReader.CaretPosition.Line] = textViewReader.GetLine(caretViewReader.CaretPosition.Line);
     }
 }
 public BaseTextViewCommand(ITextViewReadonly textViewReader, ICaretViewReadonly caretViewReader) {
     this.textViewReader = textViewReader;
     this.caretViewReader = caretViewReader;
     BeforeCommandExecutedState = new ViewState();
     AfterCommandExecutedState = new ViewState();
 }