int LineEdit::PlaceCaretNoG(int newcursor, bool sel) { if(newcursor > total) newcursor = total; Point p = GetColumnLine(newcursor); if(sel) { if(anchor < 0) { anchor = cursor; } if(rectsel || rectsel != dorectsel) Refresh(); else RefreshLines(p.y, GetLine(cursor)); rectsel = dorectsel; } else { if(anchor >= 0) { if(rectsel || dorectsel) Refresh(); else RefreshLines(GetLine(cursor), GetLine(anchor)); anchor = -1; } rectsel = false; } RefreshLine(GetColumnLine(cursor).y); RefreshLine(p.y); cursor = newcursor; ScrollIntoCursor(); PlaceCaret0(p); SelectionChanged(); WhenSel(); if(IsAnySelection()) SetSelectionSource(ClipFmtsText()); return p.x; }
void DocEdit::PlaceCaret(int newpos, bool select) { if(newpos > GetLength()) newpos = GetLength(); int z = GetLine(newpos); if(select) { if(anchor < 0) { anchor = cursor; } RefreshLines(z, GetLine(cursor)); } else if(anchor >= 0) { RefreshLines(GetLine(cursor), GetLine(anchor)); anchor = -1; } cursor = newpos; PlaceCaret(true); SelectionChanged(); if(IsSelection()) SetSelectionSource(ClipFmtsText()); }
int LineEdit::PlaceCaretNoG(int newcursor, bool sel) { if(newcursor > total) newcursor = total; Point p = GetColumnLine(newcursor); if(sel) { if(anchor < 0) { anchor = cursor; } RefreshLines(p.y, GetLine(cursor)); } else if(anchor >= 0) { RefreshLines(GetLine(cursor), GetLine(anchor)); anchor = -1; } cursor = newcursor; ScrollIntoCursor(); PlaceCaret0(p); SelectionChanged(); WhenSel(); if(IsSelection()) SetSelectionSource(ClipFmtsText()); return p.x; }