jwlodek / py_cui

A python library for intuitively creating CUI/TUI interfaces with widgets, inspired by gocui.
https://jwlodek.github.io/py_cui-docs
BSD 3-Clause "New" or "Revised" License
752 stars 42 forks source link

Vertical navigation is broken #151

Open PabloLec opened 2 years ago

PabloLec commented 2 years ago

Describe the bug Currently, you cannot use up and down arrow keys to navigate if below element is not in the same column. This means you can skip rows, e.g go from button on row 1 to button on row 5. But you cannot go from button on row 1, column 1 to button on row 5, column 2. You'll be stuck.

And, as a bonus, I think you can actually select a non selectable widget (.set_selectable(False)) via arrow keys.

To Reproduce Steps to reproduce the behavior:

  1. Create just two widgets, say two buttons.
  2. Button 1 is on row 1, column 1
  3. Button 2 is on row 2, column 2
  4. Try to use down arrow key.

Expected behavior You should be able to move to the lower (or upper) nearest neighbor. Current behavior just doesn't feel right. In my case, for RecoverPy, I want to make a form-like view and navigation is just broken at some point.

Screenshots Current: not_working

Fixed: working

I'll publish a PR in a few minutes to fix this issue.