IntCoord TextDisplay::Right (int line, int index) { TextLine* l = Line(line, false); if (l == nil) { return xmin + x0; } else { return xmin + x0 + l->Offset(this, index+1) - 1; } }
IntCoord TextDisplay::Width () { if (width < 0) { if (painter != nil) { width = 0; for (int i = firstline; i <= lastline; ++i) { TextLine* line = Line(i, false); if (line != nil) { width = Math::max(width, line->Offset(this, 10000)); } } } } return width; }
void TextDisplay::DeleteText (int l, int i, int c) { TextLine* line = Line(l, true); line->Delete(this, l, i, c); if (painter != nil && width != -1) { if (l == widestline) { IntCoord w = line->Offset(this, 10000); if (w < width) { width = -1; } } } if (l == caretline) { ShowCaret(); } }
void TextDisplay::InsertText (int l, int i, const char* t, int c) { TextLine* line = Line(l, true); line->Insert(this, l, i, t, c); if (painter != nil && width != -1) { IntCoord w = line->Offset(this, 10000); if (w > width) { width = w; widestline = l; } } if (autosized) { IntCoord dw = Width() - (xmax - xmin); if (dw > 0) { xmax += dw; Redraw(xmax - dw + 1, ymin, xmax, ymax); } } if (l == caretline) { ShowCaret(); } }