Ejemplo n.º 1
0
        static CachedTextColorsCollection()
        {
            var empty = new CachedTextColorsCollection();

            empty.Freeze();
            Empty = empty;
        }
Ejemplo n.º 2
0
		public void AddOrUpdate(int docOffset, CachedTextColorsCollection newCachedTextColorsCollection) {
			for (int i = 0; i < cachedColorsList.Count; i++) {
				int mi = (previousReturnedIndex + i) % cachedColorsList.Count;
				var info = cachedColorsList[mi];
				if (info.Offset == docOffset) {
					cachedColorsList[mi] = new OffsetAndCachedColors(docOffset, newCachedTextColorsCollection);
					return;
				}
			}
			Add(docOffset, newCachedTextColorsCollection);
		}
Ejemplo n.º 3
0
		public CachedTextColorsCollectionBuilder(ReplEditor owner, int totalLength) {
			this.owner = owner;
			cachedTextColorsCollection = new CachedTextColorsCollection();
			this.totalLength = totalLength;
		}
Ejemplo n.º 4
0
		void AddNewDocument() {
			docVersion++;
			prevCommandTextChangedState?.Cancel();
			subBuffers.Clear();
			scriptOutputCachedTextColorsCollection = null;
			cachedColorsList.Clear();
			OffsetOfPrompt = null;
			wpfTextView.TextBuffer.Replace(new Span(0, wpfTextView.TextBuffer.CurrentSnapshot.Length), string.Empty);
			ClearUndoRedoHistory();
		}
Ejemplo n.º 5
0
		public void Reset() {
			ClearPendingOutput();
			ClearUndoRedoHistory();
			CreateEmptyLastLineIfNeededAndMoveCaret();
			if (OffsetOfPrompt != null)
				AddCodeSubBuffer();
			scriptOutputCachedTextColorsCollection = null;
			WriteOffsetOfPrompt(null, true);
		}
Ejemplo n.º 6
0
		void WriteOffsetOfPrompt(int? newValue, bool force = false) {
			if (force || OffsetOfPrompt.HasValue != newValue.HasValue) {
				if (newValue == null) {
					Debug.Assert(scriptOutputCachedTextColorsCollection == null);
					scriptOutputCachedTextColorsCollection = new CachedTextColorsCollection();
					Debug.Assert(LastLine.Length == 0);
					cachedColorsList.AddOrUpdate(wpfTextView.TextSnapshot.Length, scriptOutputCachedTextColorsCollection);
				}
				else {
					Debug.Assert(scriptOutputCachedTextColorsCollection != null);
					scriptOutputCachedTextColorsCollection = null;
				}
			}
			OffsetOfPrompt = newValue;
		}
Ejemplo n.º 7
0
		void SetNewDocument() {
			cachedTextColorsCollection = new CachedTextColorsCollection();
			wpfTextView.TextBuffer.Replace(new Span(0, wpfTextView.TextBuffer.CurrentSnapshot.Length), string.Empty);
			ClearUndoRedoHistory();
			cachedColorsList.Clear();
			cachedColorsList.Add(0, cachedTextColorsCollection);
		}
Ejemplo n.º 8
0
		public void Add(int offset, CachedTextColorsCollection cachedTextColorsCollection) {
			Debug.Assert((cachedColorsList.Count == 0 && offset == 0) || (cachedColorsList.Count > 0 && cachedColorsList.Last().Offset + cachedColorsList.Last().CachedColors.TextLength <= offset));
			cachedColorsList.Add(new OffsetAndCachedColors(offset, cachedTextColorsCollection));
		}
Ejemplo n.º 9
0
		public OffsetAndCachedColors(int offset, CachedTextColorsCollection cachedColors) {
			Offset = offset;
			CachedColors = cachedColors;
		}