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); }
public void ReplaceAllImpl() { // まず、実行する置換を全てここに登録する //doc::MacroCommand mcr; // 置換後文字列 //const wchar_t* ustr = replStr_.ConvToWChar(); //const ulong ulen = my_lstrlenW( ustr ); List <ICommand> mcr = new List <ICommand>(); // 文書の頭から検索 int dif = 0; DPos s = new DPos(0, 0);//s(0,0) DPos b = new DPos(); DPos e = new DPos(); while (FindNextFromImpl(new DPos(s), ref b, ref e)) { if (s.tl != b.tl) { dif = 0; } //s = e; s.tl = e.tl; s.ad = e.ad; // 置換コマンドを登録 b.ad += dif; e.ad += dif; mcr.Add(new Replace(b, e, ReplaceWord)); dif -= e.ad - b.ad - ReplaceWord.Length; int f = dif; } //if( mcr.size() > 0 ){ // // ここで連続置換 // edit.getDoc().Execute( mcr ); // // カーソル移動 // e.ad = b.ad + ulen; // edit.cursor.MoveCur( e, false ); // // 閉じる? // //End( IDOK ); //} if (mcr.Count > 0) { // ここで連続置換 foreach (var cmd in mcr) { //view.GetDocument().Execute(cmd); document.Execute(cmd); } // カーソル移動 e.ad = b.ad + ReplaceWord.Length; //view.cursor.MoveCur(e, false); view.MoveCursor(e); } }