static void _gt_cursor_pos(GTextField *gt, int sel_start, int *x, int *y) {
    int l, sel;

    *x = -1; *y= -1;
    GDrawSetFont(gt->g.base,gt->font);
    l = GTextFieldFindLine(gt,sel_start);
    if ( l<gt->loff_top || l>=gt->loff_top + ((gt->g.inner.height+gt->fh/2)/gt->fh))
return;
    *y = (l-gt->loff_top)*gt->fh;
    GRect pos_rect;
    int ll = gt->lines8[l+1]==-1 ? -1 : gt->lines8[l+1]-gt->lines8[l];
    sel = u2utf8_index(sel_start-gt->lines[l],gt->utf8_text+gt->lines8[l]);
    GDrawLayoutInit(gt->g.base,gt->utf8_text+gt->lines8[l],ll,NULL);
    GDrawLayoutIndexToPos(gt->g.base,sel,&pos_rect);
    *x = pos_rect.x - gt->xoff_left;
}
static void _gt_cursor_pos(GTextField *gt, int sel_start, int *x, int *y) {
    int l, sel;

    *x = -1; *y= -1;
    GDrawSetFont(gt->g.base,gt->font);
    l = GTextFieldFindLine(gt,sel_start);
    if ( l<gt->loff_top || l>=gt->loff_top + ((gt->g.inner.height+gt->fh/2)/gt->fh))
return;
    *y = (l-gt->loff_top)*gt->fh;
    GRect pos_rect;
    int ll = gt->lines8[l+1]==-1 ? -1 : gt->lines8[l+1]-gt->lines8[l];
    sel = u2utf8_index(sel_start-gt->lines[l],gt->utf8_text+gt->lines8[l]);
    GDrawLayoutInit(gt->g.base,gt->utf8_text+gt->lines8[l],ll,NULL);
    GDrawLayoutIndexToPos(gt->g.base,sel,&pos_rect);
    *x = pos_rect.x - gt->xoff_left;
}