Skip to content
This repository has been archived by the owner on Dec 2, 2019. It is now read-only.

NK_EDIT_GOTO_END_ON_ACTIVATE not working with nk_edit_string_zero_terminated #915

Open
ilAYAli opened this issue Sep 26, 2019 · 0 comments

Comments

@ilAYAli
Copy link

ilAYAli commented Sep 26, 2019

Hi,

I am unable to get nk_edit_string_zero_terminated to scroll to the end of the output.
Neighter automatically or on focus.
NK_EDIT_GOTO_END_ON_ACTIVATE does not seem to make any difference.

Here is a gist of some code that demonstrates undesired behavior: it always shows "line: 1", but I want it to show ~ "line: 40" -> "line: 49" due to the limited window_height.

    int const window_width = 500;
    int const window_height = 200;
    std::ostringstream ss;
    for (std::size_t i = 0; i < 50; ++i) {
        ss << "line: " << i << "\n";
    }

    while (!glfwWindowShouldClose(win)) {
        glfwPollEvents();
        nk_glfw3_new_frame();

        if (nk_begin(ctx, /* Items */"", nk_rect(0, 0, float(width), float(height)), 0)) {
            nk_layout_row_begin(ctx, NK_STATIC, float(height) - 52, 1);
            nk_layout_row_push(ctx, float(width) - 23);

            nk_flags event = nk_edit_string_zero_terminated(ctx,
                NK_EDIT_SELECTABLE | NK_EDIT_MULTILINE |  NK_EDIT_CLIPBOARD | NK_EDIT_GOTO_END_ON_ACTIVATE,
                ss.str().data(), ss.str().size(), nk_filter_ascii
            );

            nk_layout_row_end(ctx);
        }
        nk_end(ctx);
...
}

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

No branches or pull requests

1 participant