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

Fixed issue where extra cursor was drawn in ImGui InputText field on TUI builds erroneously #77089

Merged
merged 1 commit into from
Oct 16, 2024

Conversation

katemonster33
Copy link
Contributor

Summary

Bugfixes "Fixes issue where the last typed character in an ImGui InputText field is covered by blank space on TUI/curses build"

Purpose of change

Fixes: #76129

Describe the solution

The IME Pre-Edit Text PR caused a regression on TUI/curses where some extra blank space is drawn on the screen. This was because of a typo where we were comparing a pointer on the stack to NULL, which will never be true. This instead checks if the first item in the array is NULL, this implies an empty string.

Describe alternatives you've considered

could have used ifdef TUI to block out pre-edit code entirely since none of it applies to curses, this just seemed simpler.

Testing

Before: keybindings_broke
After: keybindings

Additional context

@github-actions github-actions bot added Info / User Interface Game - player communication, menus, etc. [C++] Changes (can be) made in C++. Previously named `Code` ImGui Anything related to the new ImGui UI for SDL/tiles or ImTui for curses builds <Bugfix> This is a fix for a bug (or closes open issue) json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions labels Oct 16, 2024
@akrieger
Copy link
Member

akrieger commented Oct 16, 2024

NULL and '\0' are not definitionally the same. But imgui seems to use that convention.

@akrieger
Copy link
Member

Wait nevermind, that's just the preedit text code.

Can you change these to use '\0' where we are talking about chars?

@akrieger
Copy link
Member

Or like I'll do it after idgaf.

@katemonster33
Copy link
Contributor Author

@akrieger done

@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Oct 16, 2024
@akrieger
Copy link
Member

akrieger commented Oct 16, 2024

Is the pointer always guaranteed to be nonnull? Like this won't cause any null pointer dereferences right?

Edit: it's a preallocated array, nevermind.

@akrieger akrieger merged commit f44d4a3 into CleverRaven:master Oct 16, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` ImGui Anything related to the new ImGui UI for SDL/tiles or ImTui for curses builds Info / User Interface Game - player communication, menus, etc. json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

curses/imtui: cursor is duplicated when searching in the keybinding menu
2 participants