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

ImGuiInputTextFlags conflict with InputTextMultiline #4409

Closed
kfsone opened this issue Aug 8, 2021 · 2 comments
Closed

ImGuiInputTextFlags conflict with InputTextMultiline #4409

kfsone opened this issue Aug 8, 2021 · 2 comments

Comments

@kfsone
Copy link
Contributor

kfsone commented Aug 8, 2021

   static char b1[256], b2[256], b3[256];
   ImGui::InputTextMultiline("##t1", b1, 255, ImVec2(0,0), ImGuiInputTextFlags_None);
   ImGui::InputTextMultiline("##t2", b2, 255, ImVec2(0,0), ImGuiInputTextFlags_CharsHexadecimal);
   ImGui::InputTextMultiline("##t3", b3, 255, ImVec2(0,0), ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CtrlEnterForNewline);

In the first, you can enter multi-line text as expected.

In the second, you can only enter hexadecimal characters -- not including enter.

In the third, you still can't insert a newline.

Suggestion: If these flags are set, allow those characters to skip the named-filter checks.

PR to follow.

kfsone added a commit to kfsone/imgui that referenced this issue Aug 8, 2021
@kfsone
Copy link
Contributor Author

kfsone commented Aug 8, 2021

see https://www.github.com/kfsone/imgui-stuff for a simple demo of the problem.

kfsone added a commit to kfsone/imgui that referenced this issue Aug 14, 2021
kfsone added a commit to kfsone/imgui that referenced this issue Aug 14, 2021
kfsone added a commit to kfsone/imgui that referenced this issue Aug 14, 2021
`ImGui::InputTextMultiLine` stops being multi-line when the flags also
specify one of the named character filters.

```cpp
    char b1[256] = "1A2B\n3C4D\n", b2[256] = "1A2B\n3C4D";
    ImGui::InputTextMultiline("##t1", b1, 255, ImVec2(0,0), ImGuiInputTextFlags_None);
    ImGui::InputTextMultiline("##t2", b2, 255, ImVec2(0,0), ImGuiInputTextFlags_CharsHexadecimal);
```

In the above example, it is not possible to add a new newline to the
input box, because that input gets filtered out.

This fix short-circuits the existing checks on newline and tab so that
are not subsequently nixed by a named filter.
kfsone added a commit to kfsone/imgui that referenced this issue Aug 15, 2021
Implements ocornut#4409: `ImGui::InputTextMultiLine` stops being multi-line when the flags also
specify one of the named character filters.

```cpp
    char b1[256] = "1A2B\n3C4D\n", b2[256] = "1A2B\n3C4D";
    ImGui::InputTextMultiline("##t1", b1, 255, ImVec2(0,0), ImGuiInputTextFlags_None);
    ImGui::InputTextMultiline("##t2", b2, 255, ImVec2(0,0), ImGuiInputTextFlags_CharsHexadecimal);
```

In the above example, it is not possible to add a new newline to the
input box, because that input gets filtered out.

This fix short-circuits the existing checks on newline and tab so that
are not subsequently nixed by a named filter.
@ocornut
Copy link
Owner

ocornut commented Aug 17, 2021

Thank you Olivier,
This is now merged as 7e9e1ff

@ocornut ocornut closed this as completed Aug 17, 2021
AnClark pushed a commit to AnClark/imgui-vst-mod that referenced this issue Aug 30, 2021
AnClark pushed a commit to AnClark/imgui-vst-mod that referenced this issue Aug 30, 2021
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

2 participants