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

Fix using named filters with InputTextMultiline #4410

Closed
wants to merge 1 commit into from

Conversation

kfsone
Copy link
Contributor

@kfsone kfsone commented Aug 8, 2021

This change leverages the existing < 0x20 check and it's newline/tab-to-flag matching to allow those characters to explicitly bypass the named filter checks when the given flag is enabled.

You can thus have a multiline input text that only allows, e.g, uppercase hex characters, but still have multipline lines.

@ocornut ocornut changed the title Implements #4409 Fix using named filters with InputTextMultiline Aug 10, 2021
@kfsone
Copy link
Contributor Author

kfsone commented Aug 14, 2021

Squash incoming :)

@kfsone kfsone force-pushed the bug/fix-multiline-newlines branch 3 times, most recently from bb49d1c to b9b1de7 Compare August 14, 2021 01:54
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.
@kfsone kfsone force-pushed the bug/fix-multiline-newlines branch from b9b1de7 to 912ecd3 Compare August 15, 2021 21:40
ocornut pushed a commit that referenced this pull request Aug 17, 2021
@ocornut
Copy link
Owner

ocornut commented Aug 17, 2021

Thank you Olivier,
This is now merged as 7e9e1ff (minor tweaks + added changelog)

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

Successfully merging this pull request may close these issues.

2 participants