Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Horizontal scroll bug #692

Closed
v71 opened this issue Jun 10, 2016 · 11 comments
Closed

Horizontal scroll bug #692

v71 opened this issue Jun 10, 2016 · 11 comments

Comments

@v71
Copy link

v71 commented Jun 10, 2016

I don't know if this has already been discussed but i think there is a bug in the horizontal scrollview, you can test in the demo, open the log and try to scroll the window, the scroll bar doesn't reach the end and resets itself to zero i tried to use flags combinations to no avail.

@MINIONBOTS
Copy link

Generally I seem to be unable to put a horizontal scrollbar on a multiline inputtext window inside a TreeNode, tried a lot already, from setting the width manually to trying to enforce it on a Begin/End-ChildRegion.

@ocornut
Copy link
Owner

ocornut commented Jun 11, 2016

@v71 please clarify because I don't understand what you are saying there, and I couldn't see an obvious bug with neither vertical or horizontal scrollbar in the Log demo (tried just now).

@MINIONBOTS ?? I don't understand what you are talking about either or how it is related. Please clarify and possibly in a different topic because it seem unrelated.

Please provide screenshots and clear repro steps or code. Thanks!

@v71
Copy link
Author

v71 commented Jun 11, 2016

I found the bug when i tried to display a text using the log window which comes with the examples.
If you want to test it quickly, download the examples zip , unzip and run , invoke the log window in the examples window, shrink the log window , then drag the horizontal scroll bar , you will notice that the bar won't reach the entire extent , but it will reset to zero before reaching the extreme end of the child window containg the log informations.

@ocornut
Copy link
Owner

ocornut commented Jun 11, 2016

@v71 This is what I am doing but I don't see a problem with the horizontal scrollbar.

horizontal_scrollbar

@v71
Copy link
Author

v71 commented Jun 11, 2016

Try to shrink the window couple of times , as soon as i get home i will record a vide

@v71
Copy link
Author

v71 commented Jun 11, 2016

Ok i managed to record a short video, ( there is 10 mb limit ) , it happens when i schrink a couple of times the window , sometimes it works at the first run, but it sistematiccaly presents itself everytime i run the code.Sorry for the zip i have only an avi recorded nad github doesn't support it.

scroll.zip

@ocornut
Copy link
Owner

ocornut commented Jun 11, 2016

Well

  1. As you can see it works in the Log demo above.
  2. Your video doesn't show the Log window but something different.
    Are you actually reproducing the bug on the Demo: Log window? Or with different code?!

@v71
Copy link
Author

v71 commented Jun 11, 2016

Oh yes, this is a window i created for my engine , it shows the log, i have used the exact code coming from the example file , here it is :

    void Draw(const char* title, bool* p_open = NULL)
    {
        ImGui::SetNextWindowSize(ImVec2(600, 400), ImGuiSetCond_FirstUseEver);
        ImGui::Begin(title, p_open);
        if (ImGui::Button("Clear")) Clear();
        ImGui::SameLine();
    //  bool copy = ImGui::Button("Copy");
        ImGui::SameLine();
        Filter.Draw("Filter", -100.0f);
        ImGui::Separator();
        ImGui::BeginChild("scrolling", ImVec2(0, 0), false, ImGuiWindowFlags_HorizontalScrollbar);
    //  if (copy) ImGui::LogToClipboard();

        if (Filter.IsActive())
        {
            const char* buf_begin = Buffer.begin();
            const char* line = buf_begin;

            for (int line_no = 0; line != NULL; line_no++)
            {
                const char* line_end = (line_no < LineOffsets.Size) ? buf_begin + LineOffsets[line_no] : NULL;

                if (Filter.PassFilter(line, line_end))
                    ImGui::TextUnformatted(line, line_end);

                line = line_end && line_end[1] ? line_end + 1 : NULL;
            }
        }
        else
        {
            ImGui::TextUnformatted(Buffer.begin());
        }

        if (ScrollToBottom)
        {
            ImGui::SetScrollHere(1.0f);
        }

        ScrollToBottom = false;

        ImGui::EndChild();

        ImGui::End();
    }

As you can see i took as it is from the example , i thought it was me doing somethign wrong so i
downloaded the examples and ran the opengl3.3 example, i ran the log example, shrunk the window a couple of time and the bug shows up

@v71
Copy link
Author

v71 commented Jun 12, 2016

There is another way to spot the bug, in the log example, shrink the window to nearly make the scroll view disapear, then enlarge it again , but do not enlarge so that you can see all the lines, if you do this , the bug shows up.

@ocornut
Copy link
Owner

ocornut commented Jun 12, 2016

OK i have managed to see a repro now. It looks like a clipping bug in the large-text path of TextUnformatted().

@ocornut ocornut added the bug label Jun 12, 2016
ocornut added a commit that referenced this issue Jun 12, 2016
@ocornut
Copy link
Owner

ocornut commented Jun 12, 2016

Fixed now. It was a stupid bug with TextUnformatted() handling of large-text clipping with horizontal scrolling. Thanks and sorry for taking a while to see it !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants