コード例 #1
0
        void ReplaceInSelection()
        {
            int startOffset = Math.Min(selection.Offset, selection.EndOffset);
            int endOffset   = Math.Max(selection.Offset, selection.EndOffset);

            if (findFirst)
            {
                SetCaretPosition(textEditor.ActiveTextAreaControl.TextArea, startOffset);
            }

            try {
                ignoreSelectionChanges = true;
                if (findFirst)
                {
                    findFirst = false;
                    SearchReplaceManager.ReplaceFirstInSelection(startOffset, endOffset - startOffset, null);
                }
                else
                {
                    findFirst = !SearchReplaceManager.ReplaceNextInSelection(null);
                    if (findFirst)
                    {
                        SearchReplaceUtilities.SelectText(textEditor, startOffset, endOffset);
                    }
                }
            } finally {
                ignoreSelectionChanges = false;
            }
        }
コード例 #2
0
        void ReplaceInSelection()
        {
            int startOffset = Math.Min(selection.Offset, selection.EndOffset);
            int endOffset   = Math.Max(selection.Offset, selection.EndOffset);

            if (findFirst)
            {
                textEditor.Caret.Offset = startOffset;
            }

            try {
                ignoreSelectionChanges = true;
                if (findFirst)
                {
                    findFirst = false;
                    SearchReplaceManager.ReplaceFirstInSelection(startOffset, endOffset - startOffset, null);
                }
                else
                {
                    findFirst = !SearchReplaceManager.ReplaceNextInSelection(null);
                    if (findFirst)
                    {
                        textEditor.Select(startOffset, endOffset - startOffset);
                    }
                }
            } finally {
                ignoreSelectionChanges = false;
            }
        }