Exemplo n.º 1
0
		internal static Int32 UpdatePositiveTrackingPoint(TextChange change, Int32 position)
		{
			if (change.Position <= position)
			{
				if (change.OldEnd <= position)
				{
					position += change.Delta;
					return position;
				}

				position = change.NewEnd;
			}

			return position;
		}
Exemplo n.º 2
0
		/*
		 * StableSort
		 */

		private static TextChange[] StableSort(IList<TextChange> changes)
		{
			var array = new TextChange[changes.Count];
			changes.CopyTo(array, 0);

			for (var i = 0; i < array.Length - 1; i++)
			{
				Int32 position = array[i].Position;
				var index = i;

				for (var j = i + 1; j < array.Length; j++)
				{
					if (array[j].Position < position)
					{
						position = array[j].Position;
						index = j;
					}
				}

				NuGenArgument.Exchange<TextChange>(ref array[i], ref array[index]);
			}

			return array;
		}