Ejemplo n.º 1
0
        public static void SelectNextMatched()
        {
            RTB.Focus();
            if (_matches.Length == 0)
            {
                return;
            }
            PositionInMatches p = CursorBetweenMatches();

            if (p.NextMatchedNumber >= _matches.Length)
            {
                return;
            }
            int selectMatches;

            if (p.CursorOnBeginMatchedItem && RTB.SelectionLength != _matches[p.PreviosMatchedNumber].Y) //if no previus matched selected, select it, other select next matched
            {
                selectMatches = p.PreviosMatchedNumber;
            }
            else
            {
                selectMatches = p.NextMatchedNumber;
            }

            if (selectMatches < 0)
            {
                selectMatches = 0;
            }
            //if (selectMatches > _matches.Length - 1) selectMatches = _matches.Length - 1; canceled: added check in start of function

            RTB.Select(_matches[selectMatches].X, _matches[selectMatches].Y);
            CurrentMatchedSelected = selectMatches + 1;
        }
Ejemplo n.º 2
0
        public static void SelectPreviosMatched()
        {
            RTB.Focus();
            if (_matches.Length == 0)
            {
                return;
            }
            PositionInMatches p = CursorBetweenMatches();
            int selectMatches   = p.PreviosMatchedNumber;

            if (selectMatches < 0)
            {
                return;
            }
            if (p.CursorOnBeginMatchedItem)
            {
                selectMatches--;
            }
            if (selectMatches < 0)
            {
                selectMatches = 0;
            }

            RTB.Select(_matches[selectMatches].X, _matches[selectMatches].Y);
            CurrentMatchedSelected = selectMatches + 1;
        }