override public bool Init() { eraseCommand = new EraseSelectionCommand(); eraseCommand.lines = lines; eraseCommand.selections = selections; eraseCommand.Init(); return(true); }
override public void Undo() { if (eraseCommand != null) { eraseCommand.Undo(); eraseCommand = null; } SetSelectionMementos(mementos); }
override public void Undo() { if (eraseCommand != null) { eraseCommand.Undo(); eraseCommand = null; } SetSelectionMementos(mementos); lines.viStoreSelector.ViStoreMementos(mementos); }
override public void Redo() { lines.ResizeSelections(ranges.Count); for (int i = ranges.Count; i-- > 0;) { SimpleRange range = ranges[i]; Selection selection = selections[i]; selection.anchor = lines.IndexOf(new Place(0, range.index)); Line endLine = lines[range.index + range.count - 1]; selection.caret = lines.IndexOf(new Place(endLine.charsCount, range.index + range.count - 1)); } EraseSelectionCommand eraseCommand = new EraseSelectionCommand(); eraseCommand.lines = lines; eraseCommand.selections = lines.selections; if (eraseCommand.Init()) { eraseCommand.Redo(); this.eraseCommand = eraseCommand; } }
override public void Redo() { lines.ResizeSelections(ranges.Count); for (int i = ranges.Count; i-- > 0;) { SimpleRange range = ranges[i]; Line endLine = lines[range.index + range.count - 1]; Selection selection = selections[i]; if (range.index > 0 && range.index + range.count == lines.LinesCount) { Line startLine = lines[range.index - 1]; selection.anchor = lines.IndexOf(new Place(startLine.NormalCount, range.index - 1)); selection.caret = lines.IndexOf(new Place(endLine.charsCount, range.index + range.count - 1)); } else { selection.anchor = lines.IndexOf(new Place(0, range.index)); selection.caret = lines.IndexOf(new Place(endLine.charsCount, range.index + range.count - 1)); } } EraseSelectionCommand eraseCommand = new EraseSelectionCommand(); eraseCommand.lines = lines; eraseCommand.selections = lines.selections; if (eraseCommand.Init()) { eraseCommand.Redo(); this.eraseCommand = eraseCommand; } else { this.eraseCommand = null; } controller.ViMoveHome(false, true); }