Exemplo n.º 1
0
		private SnippetLinkRange addSnippetLink(SnippetLinkRange range)
		{
			string key = range.Key;
			SnippetLink sl = null;
			for (int i = 0; i < _snippetLinks.Count; i++)
			{
				if (_snippetLinks[i].Key.Equals(key, StringComparison.CurrentCultureIgnoreCase))
				{
					sl = _snippetLinks[i];
					break;
				}
			}
			if (sl == null)
			{
				sl = new SnippetLink(key);
				_snippetLinks.Add(sl);
			}

			sl.Ranges.Add(range);
			range.Parent = sl.Ranges;

			return range;
		}
Exemplo n.º 2
0
		private void cascadeSnippetLinkRangeChange(SnippetLink oldActiveSnippetLink, SnippetLinkRange oldActiveRange)
		{
			Scintilla.ManagedRanges.Sort();

			int offset = 0;

			string newText = oldActiveRange.Text;


			Scintilla.NativeInterface.SetModEventMask(0);
			foreach (ManagedRange mr in Scintilla.ManagedRanges)
			{
				if (offset != 0)
					mr.Change(mr.Start + offset, mr.End + offset);

				SnippetLinkRange slr = mr as SnippetLinkRange;
				if (slr == null || !oldActiveSnippetLink.Ranges.Contains(slr) || slr.Text == newText)
					continue;

				int oldLength = slr.Length;
				slr.Text = newText;
				slr.End += newText.Length - oldLength;
				offset += newText.Length - oldLength;
			}

			Scintilla.NativeInterface.SetModEventMask(Constants.SC_MODEVENTMASKALL);
		}