diff options
| author | Juan Linietsky | 2016-06-14 08:09:27 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2016-06-14 08:10:25 -0300 |
| commit | c204170232a6e15d60ad67e684b21453abd71184 (patch) | |
| tree | 82c57240cf8bdad15897b99dec7ed1100e5100ad | |
| parent | f57d6eef983e5abb650793af173bab79544e48b9 (diff) | |
| download | godot-c204170232a6e15d60ad67e684b21453abd71184.tar.gz godot-c204170232a6e15d60ad67e684b21453abd71184.tar.zst godot-c204170232a6e15d60ad67e684b21453abd71184.zip | |
correctly wrap lines longer than width in richtextlabel, fixes #4735
| -rw-r--r-- | scene/gui/rich_text_label.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 80949b4eb..786ce27a0 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -278,6 +278,11 @@ if (m_height > line_height) {\ if (c[end]=='\t') { 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; if (c[end]==' ') { @@ -340,10 +345,12 @@ if (m_height > line_height) {\ int cw=font->get_char_size(c[i],c[i+1]).x; + if (c[i]=='\t') { cw=tab_size*font->get_char_size(' ').width; } + if (p_click_pos.x-cw/2>p_ofs.x+align_ofs+pofs) { rchar=int((&c[i])-cf); |
