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

Some curses UI fixes #39585

Merged
merged 5 commits into from
Apr 16, 2020
Merged

Some curses UI fixes #39585

merged 5 commits into from
Apr 16, 2020

Conversation

Qrox
Copy link
Contributor

@Qrox Qrox commented Apr 15, 2020

Summary

SUMMARY: Interface "Some curses UI fixes"

Purpose of change

  1. Only show the warning about the lack of utf-8 encoding once
  2. Use the whole terminal for encoding/teminal size warnings.
  3. Avoid returning from input_manager::get_input_event when resizing the terminal to match the tiles behavior.
  4. Avoid re-entry into game::init_ui when showing encoding/terminal size warnings by not calling input_manager::wait_for_any_key.

Describe the solution

  1. Move the check into the first_init branch.
  2. Print to catacurses::stdscr.
  3. Add a loop that only exits when getch() returns a value other than KEY_RESIZE.
  4. Move the warning code to ncurses_def.cpp and use getch instead.

Testing

Tested on MSYS2.

  1. Resized the terminal and the encoding warning no longer showed.
  2. Resized the terminal and the whole screen was used.
  3. Interacted with an in-game console, resized when prompted to enter any key, and the resizing was correctly handled instead of being handled as a key press.
  4. Started the game / resized the terminal and the encoding/terminal size warnings were correctly closed by a key press / resizing the window, respectively.

@lgtm-com
Copy link

lgtm-com bot commented Apr 15, 2020

This pull request introduces 2 alerts when merging e09782e into b793146 - view on LGTM.com

new alerts:

  • 2 for Function declared in block

@Qrox Qrox force-pushed the curses-ui-fixes branch from 7d091cd to c6a58a2 Compare April 15, 2020 15:25
@ZhilkinSerg ZhilkinSerg added [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. labels Apr 15, 2020
@ZhilkinSerg ZhilkinSerg merged commit fd4e00f into CleverRaven:master Apr 16, 2020
@Qrox Qrox deleted the curses-ui-fixes branch April 17, 2020 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[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.

2 participants