Horizontal scroll bug #692

Closed
opened 2016-06-10 21:55:24 +00:00 by v71 · 11 comments
v71 commented 2016-06-10 21:55:24 +00:00 (Migrated from github.com)

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.

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 commented 2016-06-11 05:55:56 +00:00 (Migrated from github.com)

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.

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 commented 2016-06-11 07:45:37 +00:00 (Migrated from github.com)

@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 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 commented 2016-06-11 13:25:45 +00:00 (Migrated from github.com)

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.

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 commented 2016-06-11 15:50:01 +00:00 (Migrated from github.com)

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

horizontal_scrollbar

@v71 This is what I am doing but I don't see a problem with the horizontal scrollbar. ![horizontal_scrollbar](https://cloud.githubusercontent.com/assets/8225057/15985953/e0e94450-2ffc-11e6-9a3d-3fed9e3cc4ea.gif)
v71 commented 2016-06-11 19:24:55 +00:00 (Migrated from github.com)

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

Try to shrink the window couple of times , as soon as i get home i will record a vide
v71 commented 2016-06-11 20:04:02 +00:00 (Migrated from github.com)

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

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](https://github.com/ocornut/imgui/files/310446/scroll.zip)
ocornut commented 2016-06-11 21:16:35 +00:00 (Migrated from github.com)

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?!
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 commented 2016-06-11 22:33:26 +00:00 (Migrated from github.com)

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

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 commented 2016-06-12 09:19:26 +00:00 (Migrated from github.com)

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.

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 commented 2016-06-12 10:10:41 +00:00 (Migrated from github.com)

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

OK i have managed to see a repro now. It looks like a clipping bug in the large-text path of TextUnformatted().
ocornut commented 2016-06-12 10:25:21 +00:00 (Migrated from github.com)

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 !

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 in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#692
No description provided.