anchor.diff:    FFont := fpgGetFont(AValue);
     if Height < FFont.Height + 6 then
       Height:= FFont.Height + 6;
  +  AdjustVisibleText;
     RePaint;
   end;
   
  
positive.code: 
  { TfpgCustomEdit }
  
  procedure TfpgCustomEdit.AdjustCursor;
  var
    tw: integer;
    VisibleWidth: integer;
  begin
    tw           := FFont.TextWidth(UTF8Copy(GetDrawText, 1, FCursorPos));
    VisibleWidth := (FWidth - 2 * FSideMargin);
  
    if tw - FDrawOffset > VisibleWidth - 2 then
      FDrawOffset := tw - VisibleWidth + 2
    else if tw - FDrawOffset < 0 then
    begin
      FDrawOffset := tw;
      if tw <> 0 then
        Dec(FDrawOffset, 2);
    end;
  end;
  
  function TfpgCustomEdit.CursorPosToCharPos(x, y: integer): integer;
  var
    n: integer;
    cpx: integer;
    cx: integer;
    dtext: string;
    tw, dpos: integer;
    // tc: Cardinal;
    ch: TfpgChar;
  begin
    // searching the appropriate character position
    ch     := '';
    dtext  := GetDrawText;
    cpx    := FFont.TextWidth(UTF8Copy(dtext, 1, FCursorPos)) - FDrawOffset + FSideMargin;
    Result := FCursorPos;
    
    // tc := fpgGetTickCount;
    {for n := 0 to UTF8Length(dtext) do
    begin
      cx := FFont.TextWidth(UTF8Copy(dtext, 1, n)) - FDrawOffset + FSideMargin;
      if abs(cx - x) < abs(cpx - x) then
      begin
        cpx    := cx;
        Result := n;
      end;
    end;}
    
    tw   := 0;
    n    := 0;
    dpos := 0;
    while dpos <= Length(dtext) do
    begin
      dpos := UTF8CharAtByte(dtext, dpos, ch);
      tw := tw + FFont.TextWidth(ch);
      cx := tw - FDrawOffset + FSideMargin;
      if abs(cx - x) < abs(cpx - x) then
      begin
        cpx    := cx;
        Result := n;
      end;
      Inc(n);
    end;
    // writeln(fpgGetTickCount - tc);
  end;
  
  procedure TfpgCustomEdit.SetBorderStyle(const AValue: TfpgEditBorderStyle);
  
negative.code: 
    Canvas.FillRectangle(r);
    dtext := GetDrawText;
    
    Canvas.SetFont(FFont);
    Canvas.SetTextColor(FTextColor);
    // fpgStyle.DrawString(Canvas, -FTextOffset + FSideMargin, 3, dtext, Enabled);
    fpgStyle.DrawString(Canvas, -FDrawOffset + FSideMargin, 3, FVisibleText, Enabled);
  
    if Focused then
    begin
  