Ejemplo n.º 1
0
        public static void AddRecentLocation(string assetGuid, FGTextBuffer.CaretPos caretPosition, bool insert)
        {
            if (_instance == null)
            {
                return;
            }

            var newLocation = new RecentLocation {
                assetGuid = assetGuid,
                line      = caretPosition.line,
                index     = caretPosition.characterIndex
            };

            if (insert && _instance.recentLocationsOffset != 0)
            {
                var current = _instance.recentLocations.Count - _instance.recentLocationsOffset;
                _instance.recentLocations.Insert(current, newLocation);
            }
            else
            {
                if (_instance.recentLocationsOffset != 0)
                {
                    var current = _instance.recentLocations.Count - _instance.recentLocationsOffset;
                    _instance.recentLocations.RemoveRange(current, _instance.recentLocationsOffset);
                }
                _instance.recentLocations.Add(newLocation);
                _instance.recentLocationsOffset = 0;
            }

            if (_instance.recentLocations.Count > 100 + _instance.recentLocationsOffset)
            {
                _instance.recentLocations.RemoveRange(0, _instance.recentLocations.Count - 100 - _instance.recentLocationsOffset);
            }
        }
Ejemplo n.º 2
0
        public static void AddRecentLocation(string assetGuid, FGTextBuffer.CaretPos caretPosition, bool insert)
        {
            if (_instance == null)
            return;

            var newLocation = new RecentLocation {
            assetGuid = assetGuid,
            line = caretPosition.line,
            index = caretPosition.characterIndex
            };

            if (insert && _instance.recentLocationsOffset != 0)
            {
            var current = _instance.recentLocations.Count - _instance.recentLocationsOffset;
            _instance.recentLocations.Insert(current, newLocation);
            }
            else
            {
            if (_instance.recentLocationsOffset != 0)
            {
                var current = _instance.recentLocations.Count - _instance.recentLocationsOffset;
                _instance.recentLocations.RemoveRange(current, _instance.recentLocationsOffset);
            }
            _instance.recentLocations.Add(newLocation);
            _instance.recentLocationsOffset = 0;
            }

            if (_instance.recentLocations.Count > 100 + _instance.recentLocationsOffset)
            {
            _instance.recentLocations.RemoveRange(0, _instance.recentLocations.Count - 100 - _instance.recentLocationsOffset);
            }
        }