Exemple #1
0
        private bool Update()
        {
            var currentPath = StringUtils.NormalizePath(_gateway.GetFullCurrentPath());

            var firstVisibleLine = _gateway.GetFirstVisibleLine(); // здесь не учитваются заколлапшенные строки

            var startLineIndex = _gateway.DocLineFromVisible(firstVisibleLine);
            var linesOnScreen  = _gateway.LinesOnScreen();
            var endLineIndex   = _gateway.DocLineFromVisible(firstVisibleLine + linesOnScreen);
            var endPosition    = _gateway.GetLineEndPosition(endLineIndex).Value;

            bool changed = currentPath != _currentPath;

            if (changed)
            {
                _expectedWords = _settingsMapping
                                 .Select(item => item.Src)
                                 .Where(src => src.MatchesWithPath(currentPath))
                                 .Select(src => src.Word)
                                 .ToList();
            }

            changed = changed ||
                      startLineIndex != _startLineIndex ||
                      endPosition != _endPosition;

            _currentPath    = currentPath;
            _startLineIndex = startLineIndex;
            _endPosition    = endPosition;

            return(changed);
        }