예제 #1
0
        internal bool IsReadOnly(ITextBuffer textBuffer)
        {
            var editorOptions = _editorOptionsFactoryService.GetOptions(textBuffer);

            if (editorOptions != null &&
                EditorOptionsUtil.GetOptionValueOrDefault(editorOptions, DefaultTextViewOptions.ViewProhibitUserInputId, false))
            {
                return(true);
            }

            var textLines = _editorAdaptersFactoryService.GetBufferAdapter(textBuffer);

            if (textLines == null)
            {
                return(false);
            }

            uint flags;

            if (ErrorHandler.Succeeded(textLines.GetStateFlags(out flags)) &&
                0 != (flags & (uint)BUFFERSTATEFLAGS.BSF_USER_READONLY))
            {
                return(true);
            }

            return(false);
        }
예제 #2
0
파일: VsAdapter.cs 프로젝트: pckben/VsVim
        internal bool IsReadOnly(ITextView textView)
        {
            var editorOptions = textView.Options;

            if (editorOptions != null &&
                EditorOptionsUtil.GetOptionValueOrDefault(editorOptions, DefaultTextViewOptions.ViewProhibitUserInputId, false))
            {
                return(true);
            }

            return(IsReadOnly(textView.TextBuffer));
        }