AllenDang/giu

g.Label("very long ........ text") is not shown completely

francmarx opened this issue · 17 comments

What happend?

if you put some very long text string into g.Label(), string is not shown completely, only the first 3000 chars

Code example

simply try this:

g.Label(strings.Repeat("testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest\n", 40)),

Version

master

OS

linux

The limitation comes from upstream imgui.

In the earlier versions (imgui-go), labels with strings >3000 were possible, was anything changed in the upstream imgui?

strange, something with imgui has to be broken... I'll check this when my local cimgui compiles 😄

in cimgui that seems to work...
image

I'll check in giu as I compile it

in giu it works as well
image
@francmarx did you use Label(...).Wrapped(true)?

@AllenDang no, I don't use Wrapped(true).

try much more then 3000 characters:

g.Label(strings.Repeat("testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest\n", 50))

gives left side, but should look like right side:

image

I see, could you check if it also happens in C++ imgui?

It happens to cimgui-go too

this seems to be something in Dear ImGui

        ImGui::SetNextWindowSize(ImVec2{600,600});
        ImGui::Begin("Window");
        if (ImGui::Button("Add")) {
                j++;
        }
        ImGui::PushTextWrapPos();
        ImGui::Text(std::string(j*100, 'x').c_str());
        ImGui::End();

this acts the same

let me ping @ocornut at this point.
let us know if we should open an issue in imgui repo

TextUnformatted() doesn't have a limitation, while Text() does.
I don't know how Go works and why the function is called "Label" but if you can detect that there's no formatting ongoing (single param) you could call TextUnformatted() instead of Text().

WHat means "formatting" in Text? is it just something like Sprintf does?

ok I see:

// raw text without formatting. Roughly equivalent to Text("TextUnformattedV", text) but: A) doesn't require null terminated string if '

@ocornut
TextWidget.go has always used imgui.Text(), with earlier versions of imgui it was possible to use very long texts without any problems. Has anything significant changed in recent versions of imgui.Text() in imgui?

@francmarx it works now

@gucio321 thanks. (but there must be a significant change in recent version of imgui, in earlier versions it worked)

I think that

  1. we're using docking branch
  2. previous versions of giu were on imgui-go (which was on 1.86) and now we're using cimgui-go with upstream so 1.90.4+

something could have chaged

I don’t think it has changed, no.
Tho the underlying tempbuffer system now technically allowing resizing so its possible to “fix” it with Text() function but i am not sure it is a great idea to encourage large formattiings.