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

InputTextFilterCharacter doesn't filter Tabs (in german system) #2467

Closed
HaSa1002 opened this issue Apr 2, 2019 · 10 comments
Closed

InputTextFilterCharacter doesn't filter Tabs (in german system) #2467

HaSa1002 opened this issue Apr 2, 2019 · 10 comments

Comments

@HaSa1002
Copy link

HaSa1002 commented Apr 2, 2019

Version/Branch of Dear ImGui:

Version: 1.69
Branch: master

Back-end/Renderer/Compiler/OS

Back-ends: imgui_sfml
Operating System: Windows 10 (German as Systemlanguage)

My Issue:
You can enter a Tab in any InputText, which will cause a focus jump to the next item, but the tab is also written into the buffer. My tests of the InputTextFilterCharacter (which is my best friend...) proved, that isprint returns 64 if a tab is entered. Why is it necessary to use isprint in that case?

Standalone, minimal, complete and verifiable example:

ImGui::Begin("Bug");
static char buff[5] = "";
static char buff2[5] = "";
ImGui::InputText("Label", buff, 5);
ImGui::InputText("Label2", buff2, 5);
ImGui::End();
@ocornut
Copy link
Owner

ocornut commented Apr 2, 2019

I am not sure the SFML back-end is correct emitting both a Key and Char input.

@HaSa1002
Copy link
Author

HaSa1002 commented Apr 2, 2019

How can I check that?

@ocornut
Copy link
Owner

ocornut commented Apr 3, 2019

How can I check that?

Add print out into the SFML code calling io.AddInputCharacter() and setting KeysDown[] = xxx value. In the printout include the value of ImGui::GetFrameCount() so you can see the frame timing at which each is being emitted.

But I was wrong: most back-ends are emitting a \t character along with the Tab key. Also see #1336, so this isn't the source of the problem.

that isprint returns 64 if a tab is entered.

Could you compile this code and confirm the output:

#include <ctype.h>
[...]
    printf("isprint \\t = %d\n", isprint('\t'));
    printf("isprint \\n = %d\n", isprint('\n'));

Then provide the exact compiler you are using (which you have omitted from the issue template questions).

Thank you.

@ocornut
Copy link
Owner

ocornut commented Apr 3, 2019

Alright, welcome to compiler/std-library hell :)

https://stackoverflow.com/questions/51435249/isprint-t-evaluates-to-true-64-with-md-compiler-option
and
JuliaLang/julia#7416

I will explicitely work-around around this in the code, thanks!

ocornut added a commit that referenced this issue Apr 3, 2019
…') returns true. (#2467, #1336)

Not using isprint. + todo items.
@ocornut
Copy link
Owner

ocornut commented Apr 3, 2019

Fixed this now, thank you for the report! Also probably explains #1336 now!

@ocornut ocornut closed this as completed Apr 3, 2019
ocornut added a commit that referenced this issue Apr 3, 2019
…s characters being inserted if the back-end provided both Key and Character input. (#2467, #1336)
ocornut added a commit that referenced this issue Apr 3, 2019
… it. (#1336, #2467)

+ Fix some output filename in SDL build batch files.
ocornut added a commit that referenced this issue Apr 3, 2019
…er the back-end emits both char and keys or just keys. (#2467, #1336)
@codename-irvin
Copy link

FYI, I am still seeing this issue on Win32/DX12. I have worked around the issue for now by commenting out this code.

@ocornut ocornut reopened this Mar 24, 2022
@ocornut
Copy link
Owner

ocornut commented Mar 24, 2022

I can confirm there's an issue with the new IO queue trickling events over two frames (#4921) those tests are now invalid.

@ocornut ocornut added the bug label Mar 24, 2022
@ocornut
Copy link
Owner

ocornut commented Mar 24, 2022

@codename-irvin can you clarify precisely the issue you are getting?
I am getting two tabs inserted instead of one.
Are you on a 1.87+ backend?

ocornut added a commit that referenced this issue Mar 24, 2022
…1336)

Using Tab keys entirely now, ignoring Tab character. Technically affect who owns the repeat rate.
@ocornut
Copy link
Owner

ocornut commented Mar 24, 2022

Fixed by dfbe938

@ocornut ocornut closed this as completed Mar 24, 2022
@codename-irvin
Copy link

codename-irvin commented Mar 24, 2022

@ocornut, indeed. The issue was that I was getting two tabs inserted instead of one. Looks like I am on a 1.88 backend. I am on docking branch latest. Thanks for the fix!

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