public void Right( bool wide, bool select ) { VPos np = new VPos(); if( cur_!=sel_ && !select ){ //np = Max(cur_, sel_); //np = cur_ < sel_ ? sel_ : cur_; np.Copy(Util.Max(cur_, sel_)); np.rx = np.vx; }else{ //np = new VPos(); view_.ConvDPosToVPos( doc_.rightOf(cur_,wide), ref np, ref cur_ ); } MoveTo( np, select ); }
public void Left( bool wide, bool select ) { VPos np = new VPos(); if( cur_!=sel_ && !select ){ //np = Math.Min(cur_, sel_); //np = cur_ > sel_ ? sel_ : cur_; np.Copy(Util.Min(cur_, sel_)); np.rx = np.vx; }else{ view_.ConvDPosToVPos( doc_.leftOf(cur_,wide), ref np, ref cur_ ); } MoveTo( np, select ); }
public void on_text_update(DPos s, DPos e, DPos e2, bool mCur) { VPos search_base = new VPos(); search_base.ad = -1; if( mCur && s==cur_ && e==sel_ ){ //search_base = new VPos(cur_); search_base = cur_; } else if( mCur && s==sel_ && e==cur_ ){ //search_base = new VPos(sel_); search_base = sel_; } else{ Redraw( cur_, sel_ ); if( mCur && caret_.isAlive() ){ if( cur_ <= s ){ //search_base = &cur_; search_base.Copy(cur_); } } else{ if( s < cur_ ){ if (cur_ <= e) { //cur_ = e2 as VPos; //VPos ve2 = e2 as VPos; //cur_.Copy(ve2); cur_.tl = e2.tl; cur_.ad = e2.ad; } else if (cur_.tl == e.tl) { cur_.tl = e2.tl; cur_.ad = e2.ad + cur_.ad - e.ad; } else cur_.tl = e2.tl - e.tl; view_.ConvDPosToVPos( cur_, ref cur_ ); } if (s < sel_) //sel_ = cur_; sel_.Copy(cur_); } } if( mCur ){ view_.ConvDPosToVPos( e2, ref cur_, ref search_base ); //sel_ = cur_; sel_.Copy(cur_); if( caret_.isAlive() ) view_.ScrollTo( cur_ ); } UpdateCaretPos(); }
public bool getCurPos( out VPos start, out VPos end) { //*start = *end = &cur_; start = new VPos(); end = new VPos(); start.Copy(cur_); end.Copy(cur_); if (cur_ == sel_)//|| !caret_->isAlive() ) return false; if (cur_ < sel_) { //*end = &sel_; end.Copy(sel_); } else { //*start = &sel_; start.Copy(sel_); } return true; }