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 cursor movement of string input popup #46796

Merged
merged 5 commits into from
Jan 22, 2021

Conversation

Qrox
Copy link
Contributor

@Qrox Qrox commented Jan 16, 2021

Summary

SUMMARY: Bugfixes "Fix cursor movement of string input popup"

Purpose of change

Fix cursor movement of string input popup. For example, fix moving cursor left past the start of the displayed text causing the text to be displayed from the very beginning until cursor is moved right.

Describe the solution

  1. More precise string length and display width comparisons.
  2. Make display shift a class member instead of local to query_string.
  3. Erase non-custom string input popup window to clear IME preview text.
  4. Clean up some string operations and comments.

Testing

Moved cursor back and forth a couple times, with English or Chinese text, and it worked fine.

@BrettDong BrettDong added <Bugfix> This is a fix for a bug (or closes open issue) Controls / Input Keyboard, mouse, keybindings, input UI, etc. Info / User Interface Game - player communication, menus, etc. [C++] Changes (can be) made in C++. Previously named `Code` labels Jan 16, 2021
@BrettDong
Copy link
Member

I suggest that we shift the string by input box width when it's currently displaying some middle portion of the string and user moves the cursor to the left to view the left part of the string.

@actual-nh
Copy link
Contributor

actual-nh commented Jan 16, 2021

I suggest that we shift the string by input box width when it's currently displaying some middle portion of the string and user moves the cursor to the left to view the left part of the string.

The entire input box width, or almost that (to allow for seeing context, such as that there wasn't any part being skipped over)?

@Qrox
Copy link
Contributor Author

Qrox commented Jan 21, 2021

The entire input box width, or almost that

I went with 1/5 of the text area width or 10 characters, which ever is shorter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Controls / Input Keyboard, mouse, keybindings, input UI, etc. Info / User Interface Game - player communication, menus, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants