/// <summary>
        /// Sets the text using a <see cref="SetTextOperation"/>.
        /// </summary>
        /// <param name="lineIndex">Index of the line.</param>
        /// <param name="text">The text.</param>
        public LineBufferOperationResults SetText(
            int lineIndex,
            string text)
        {
            var operation = new SetTextOperation(lineIndex, text);

            return(Do(operation));
        }
        /// <summary>
        /// Performs the set text operation on 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(SetTextOperation operation)
        {
            // Set the text of the line.
            lines[operation.LineIndex] = operation.Text;

            // Fire a line changed operation.
            var lineChangedArgs = new LineChangedArgs(operation.LineIndex);

            RaiseLineChanged(lineChangedArgs);

            // Return the appropriate results.
            var bufferPosition = new TextPosition(
                operation.LineIndex, CharacterPosition.End);
            var results = new LineBufferOperationResults(bufferPosition);

            return(results);
        }
        protected override LineBufferOperationResults Do(SetTextOperation 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 SetTextCommand(block.BlockKey, operation.Text);
            //	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();
        }
        protected override LineBufferOperationResults Do(SetTextOperation 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 SetTextCommand(block.BlockKey, operation.Text);
            //	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();
        }
Exemplo n.º 5
0
        /// <summary>
        /// Performs the set text operation on 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(SetTextOperation operation)
        {
            LineBufferOperationResults results = base.Do(operation);

            return(CheckForStyleChanged(operation.LineIndex, results));
        }