예제 #1
0
        public bool FindPrevImpl()
        {
            // カーソル位置取得
            //VPos stt = new VPos();
            //VPos end = new VPos();
            //view.cursor.getCurPos( out stt, out end );
            DPos stt, end;

            view.GetSelction(out stt, out end);

            if (stt.ad != 0 || stt.tl != 0)
            {
                // 選択範囲先頭の1文字前から検索
                DPos s;
                if (stt.ad == 0)
                {
                    //s = new DPos( stt.tl-1, view.Document.len(stt.tl-1) );
                    s = new DPos(stt.tl - 1, view.Document.GetLength(stt.tl - 1));
                }
                else
                {
                    s = new DPos(stt.tl, stt.ad - 1);
                }

                // 検索
                DPos b = new DPos(); DPos e = new DPos();
                if (FindPrevFromImpl(s, ref b, ref e))
                {
                    // 見つかったら選択
                    //view.cursor.MoveCur( b, false );
                    //view.cursor.MoveCur( e, true );
                    view.SetSelction(b, e);

                    return(true);
                }
            }

            // 見つからなかった場合
            return(false);
        }
예제 #2
0
        public bool FindNext()
        {
            if (pos != null)
            {
                //view.cursor.MoveCur(new DPos(pos.tl, pos.ad), false);
                view.MoveCursor(new DPos(pos.tl, pos.ad));
            }

            if (search.FindNextImpl())
            {
                DPos dummy;
                if (pos == null)
                {
                    view.GetSelction(out pos, out dummy);
                }
                else
                {
                    DPos cur;
                    view.GetSelction(out cur, out dummy);
                    if (pos.tl == cur.tl && pos.ad == cur.ad)
                    {
                        //pos = view.GetSelect().t1;
                        view.GetSelction(out pos, out dummy);
                    }
                }

                return(true);
            }

            return(false);
        }