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

search: crash when navigating map after searching k sidebar #1737

Closed
lethosor opened this issue Dec 30, 2020 · 0 comments · Fixed by #1738
Closed

search: crash when navigating map after searching k sidebar #1737

lethosor opened this issue Dec 30, 2020 · 0 comments · Fixed by #1738
Assignees

Comments

@lethosor
Copy link
Member

lethosor commented Dec 30, 2020

Reported by Fleeting Flames (via Kitfox Discord)

To reproduce:

  1. With k, select a tile with at least 3 items listed in the sidebar (floors/walls included)
  2. Search and narrow down the list to under 3 items (e.g. s, beer, Enter)
  3. Navigate away from this tile with a key that has an ASCII representation (<, >, or 1-9 - not an arrow key), or with F1-F8 hotkeys (edit: the crash with hotkeys seems to occur when they are used in step 3, followed by arrow keys in step 4)
  4. Navigate to an unrevealed tile (or maybe a tile with fewer items than in step 2?) with the arrow keys (or via an announcement, etc.)

Step 4 usually crashes because the search state isn't cleared in step 3 due to the check added in 87b1524.

The logic in one of these places should probably change:

if (cursor_key_pressed(input))

for (auto it = input->begin(); it != input->end(); ++it)

We only need to intercept ASCII keys when the search field is active (step 2).

Note that changing the behavior of cursor_key_pressed may also affect the behavior of search_generic, so the proper fix here might be complicated:

else if (cursor_key_pressed(input))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant