correctly wrap lines longer than width in richtextlabel, fixes #4735

This commit is contained in:
Juan Linietsky 2016-06-14 08:09:27 -03:00
parent f57d6eef98
commit c204170232
1 changed files with 7 additions and 0 deletions

View File

@ -278,6 +278,11 @@ if (m_height > line_height) {\
if (c[end]=='\t') { if (c[end]=='\t') {
cw=tab_size*font->get_char_size(' ').width; cw=tab_size*font->get_char_size(' ').width;
} }
if (end>0 && w+cw+begin > p_width ) {
break; //don't allow lines longer than assigned width
}
w+=cw; w+=cw;
if (c[end]==' ') { if (c[end]==' ') {
@ -340,10 +345,12 @@ if (m_height > line_height) {\
int cw=font->get_char_size(c[i],c[i+1]).x; int cw=font->get_char_size(c[i],c[i+1]).x;
if (c[i]=='\t') { if (c[i]=='\t') {
cw=tab_size*font->get_char_size(' ').width; cw=tab_size*font->get_char_size(' ').width;
} }
if (p_click_pos.x-cw/2>p_ofs.x+align_ofs+pofs) { if (p_click_pos.x-cw/2>p_ofs.x+align_ofs+pofs) {
rchar=int((&c[i])-cf); rchar=int((&c[i])-cf);