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(bool scroll) { Point cr = GetCaret(cursor); int fy = font.Info().GetLineHeight(); if(scroll) { if(cursor == total) sb.End(); else sb.ScrollInto(cr.y, fy + 2); } SetCaret(cr.x + 1, cr.y - sb, 1, fy); WhenSel(); }
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; }