/// <summary>
        /// Deletes text from the buffer.
        /// </summary>
        /// <param name="operation">The operation to perform.</param>
        /// <returns>
        /// The results to the changes to the buffer.
        /// </returns>
        protected override LineBufferOperationResults Do(
            DeleteTextOperation operation)
        {
            // Get the text from the buffer, insert the text, and put it back.
            int    lineIndex           = operation.TextRange.LinePosition.GetLineIndex(lines.Count);
            string lineText            = lines[lineIndex];
            int    startCharacterIndex =
                operation.TextRange.BeginCharacterPosition.GetCharacterIndex(
                    lineText,
                    operation.TextRange.EndCharacterPosition,
                    WordSearchDirection.Left);
            int endCharacterIndex =
                operation.TextRange.EndCharacterPosition.GetCharacterIndex(
                    lineText,
                    operation.TextRange.BeginCharacterPosition,
                    WordSearchDirection.Right);

            string newLine = lineText.Remove(
                startCharacterIndex, endCharacterIndex - startCharacterIndex);

            lines[lineIndex] = newLine;

            // Fire a line changed operation.
            RaiseLineChanged(new LineChangedArgs(lineIndex));

            // Return the appropriate results.
            return(new LineBufferOperationResults(operation.TextRange.BeginTextPosition));
        }
Beispiel #2
0
        public IDeleteTextCommand <OperationContext> CreateDeleteTextCommand(
            SingleLineTextRange range)
        {
            var operation = new DeleteTextOperation(range);

            return(operation);
        }
        protected override LineBufferOperationResults Do(
            DeleteTextOperation operation)
        {
            //// We only need a read-lock on the blocks just to make sure nothing moves
            //// underneath us while we get the block key.
            //using (blocks.AcquireLock(RequestLock.Read))
            //{
            //	// Create the command and submit it to the project's command manager.
            //	Block block = blocks[operation.LineIndex];
            //	var command =
            //		new DeleteTextCommand(
            //			new BlockPosition(block.BlockKey, operation.CharacterRange.StartIndex),
            //			operation.CharacterRange.Length);
            //	commands.Do(command);

            //	// Fire a line changed operation.
            //	RaiseLineChanged(new LineChangedArgs(operation.LineIndex));

            //	// Construct the operation results for the delete from information in the
            //	// command manager.
            //	var results =
            //		new LineBufferOperationResults(
            //			new TextPosition(blocks.IndexOf(block), commands.LastPosition.TextIndex));
            //	return results;
            //}
            throw new NotImplementedException();
        }
Beispiel #4
0
        /// <summary>
        /// Deletes text from the buffer.
        /// </summary>
        /// <param name="operation">The operation to perform.</param>
        /// <returns>
        /// The results to the changes to the buffer.
        /// </returns>
        protected override LineBufferOperationResults Do(
            DeleteTextOperation operation)
        {
            LineBufferOperationResults results = base.Do(operation);

            int lineIndex = operation.TextRange.FirstLinePosition.GetLineIndex(LineCount);

            return(CheckForStyleChanged(lineIndex, results));
        }
        protected override LineBufferOperationResults Do(
			DeleteTextOperation operation)
        {
            //// We only need a read-lock on the blocks just to make sure nothing moves
            //// underneath us while we get the block key.
            //using (blocks.AcquireLock(RequestLock.Read))
            //{
            //	// Create the command and submit it to the project's command manager.
            //	Block block = blocks[operation.LineIndex];
            //	var command =
            //		new DeleteTextCommand(
            //			new BlockPosition(block.BlockKey, operation.CharacterRange.StartIndex),
            //			operation.CharacterRange.Length);
            //	commands.Do(command);

            //	// Fire a line changed operation.
            //	RaiseLineChanged(new LineChangedArgs(operation.LineIndex));

            //	// Construct the operation results for the delete from information in the
            //	// command manager.
            //	var results =
            //		new LineBufferOperationResults(
            //			new TextPosition(blocks.IndexOf(block), commands.LastPosition.TextIndex));
            //	return results;
            //}
            throw new NotImplementedException();
        }