better behavior

This commit is contained in:
cjdenio committed 2026-09-02 21:24:52 -06:00
1 parent 0eb5e1bb95
commit 9eba7080ea
1 file changed
+15 -5
+15 -5
View File
@@ -282,13 +282,23 @@ func main() {
} }
if buffer[0] >= 0x61 && buffer[0] <= 0x7a { if buffer[0] >= 0x61 && buffer[0] <= 0x7a {
cellWasFilled := state.PuzzleState[state.SelectedCell] != '-'
state.PuzzleState[state.SelectedCell] = unicode.ToUpper(rune(buffer[0])) state.PuzzleState[state.SelectedCell] = unicode.ToUpper(rune(buffer[0]))
// jump to next unfilled cell in clue
i := slices.Index(state.SelectedClue.Cells, state.SelectedCell) i := slices.Index(state.SelectedClue.Cells, state.SelectedCell)
for x := i + 1; x < len(state.SelectedClue.Cells); x++ {
if state.PuzzleState[state.SelectedClue.Cells[x]] == '-' { if !cellWasFilled {
state.SelectedCell = state.SelectedClue.Cells[x] // jump to next unfilled cell in clue
break for x := i + 1; x < len(state.SelectedClue.Cells); x++ {
if state.PuzzleState[state.SelectedClue.Cells[x]] == '-' {
state.SelectedCell = state.SelectedClue.Cells[x]
break
}
}
} else {
// jump to next cell
if i < len(state.SelectedClue.Cells)-1 {
state.SelectedCell = state.SelectedClue.Cells[i+1]
} }
} }
} }