ogarcia / opensudoku

Open Source Sudoku game for Android.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Selection / highlighting strangeness when bidirectionality is turned off

nikclayton opened this issue · comments

The selection behaviour in single number input mode results in some strangeness in the UI. I'm not sure if this is deliberately intended or not, so flagging here.

To reproduce:

  • Make sure the app is completely uninstalled

  • Install and run the app built from a6912df

  • Close the "What's new?" dialog

  • Open settings from the menu

  • Turn off "Bidirectional selection". Leave the other settings alone (so "Highlight similar cells", and "Highlight similar notes" are selected).

  • Sudoku lists > Hard > Open the first puzzle

  • Close the "Welcome" dialog

  • Close the "Popup" dialog

  • Click the input button (labeled "POP")

  • Close the "Single number" dialog

  • "1" button is highlighted, but the "6" in the grid (5 of them) are also highlighted.

Screenshot_1630686788

Expectation: At the start of the game, the number in the selected cell should match the selected keyboard button.

  • Click the 8 in r3c1. The clicked "8" is highlighted, but now so are all the "1" in the grid.

Screenshot_1630686853

Expectation: Clicking the 8 should have highlighted all the 8s in the grid, and the "1" keyboard button should still be selected.

  • Press "2" on the keypad. The 2 button is now highlighted, but the grid is not updated, an 8 and all the 1s are still highlighted.

Screenshot_1630688889

Expectation: Pressing the 2 button should have selected all the 2s in the grid, and deselected the 8 and the 1s.

  • Click the 5 in r3c3. The 5 is now highlighted, as are all the 2s. The "2" keyboard button is still selected.

Screenshot_1630686916

Expectation: Clicking the 5 should have selected all the 5s, deselecting everything else.

  • Open the settings using the gear icon
  • Press the back button to get back to the game grid
  • The "5" that was selected in the grid is now deselected, and the 6 in r1c1 is selected. The "2" on the keypad remains highlighted, as do the other "2"s in the grid.

Screenshot_1630687132

Expectation: Going to another activity and coming back should not reset the selected cell.

All of this works as expected if the bidirectional option is turned on -- but that's strange, because that is only supposed to synchronise the number in the selected cell with the keypad.

Other thoughts

  • If the selected cell in the grid is one of the given numbers maybe the numbers and clear buttons on the keypad should be disabled? Pressing one of them won't do anything as you can't overwrite a given number, or add a note to its cell.

  • Tapping on a given number in the grid ignores the "Highlight similar cells" option if it's enabled. If I tap on a given 6, for example, I would expect all the other 6s in the grid to be highlighted. Instead, the highlighted numbers match whatever is selected on the keyboard.

    This means you can have 1 set of digits highlighted, and one other completely different digit. Which feels odd.

  • This might make sense as multiple issues, but I suspect they've probably got the same cause. I haven't investigated yet, but it feels like the number selected on the keypad controls the cells that are highlighted, and tapping in the grid controls which cell is selected. But pressing a button on the keypad doesn't cause the game grid to redraw itself to show the new highlight.

If you can confirm the expected behaviour I can put together a PR to try and fix.

I'm migrating Open Sudoku development from GitHub to GitLab. To make the migration as clean as possible I'm going to close this issue. If you are still interested (or if it is still relevant), please open it again in GitLab from July 26.

Thank you very much for your understanding.