From fc8a05358a92cc3c77c5f1e30d536807ef0614fd Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Mon, 8 Apr 2019 13:49:55 +0300 Subject: were added scripting projects --- .../Editing/NoReadOnlySections.cs | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Editing/NoReadOnlySections.cs (limited to 'Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Editing/NoReadOnlySections.cs') diff --git a/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Editing/NoReadOnlySections.cs b/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Editing/NoReadOnlySections.cs new file mode 100644 index 000000000..35cd1dd1b --- /dev/null +++ b/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Editing/NoReadOnlySections.cs @@ -0,0 +1,50 @@ +// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) +// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) + +using System; +using System.Linq; +using System.Collections.Generic; +using Tango.Scripting.Editors.Document; +using Tango.Scripting.Editors.Utils; + +namespace Tango.Scripting.Editors.Editing +{ + /// + /// that has no read-only sections; all text is editable. + /// + sealed class NoReadOnlySections : IReadOnlySectionProvider + { + public static readonly NoReadOnlySections Instance = new NoReadOnlySections(); + + public bool CanInsert(int offset) + { + return true; + } + + public IEnumerable GetDeletableSegments(ISegment segment) + { + if (segment == null) + throw new ArgumentNullException("segment"); + // the segment is always deletable + return ExtensionMethods.Sequence(segment); + } + } + + /// + /// that completely disables editing. + /// + sealed class ReadOnlyDocument : IReadOnlySectionProvider + { + public static readonly ReadOnlyDocument Instance = new ReadOnlyDocument(); + + public bool CanInsert(int offset) + { + return false; + } + + public IEnumerable GetDeletableSegments(ISegment segment) + { + return Enumerable.Empty(); + } + } +} -- cgit v1.3.1