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); }
internal bool IsReadOnly(ITextView textView) { var editorOptions = textView.Options; if (editorOptions != null && EditorOptionsUtil.GetOptionValueOrDefault(editorOptions, DefaultTextViewOptions.ViewProhibitUserInputId, false)) { return(true); } return(IsReadOnly(textView.TextBuffer)); }