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
+11 -1
+11 -1
View File
@@ -282,15 +282,25 @@ 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)
if !cellWasFilled {
// jump to next unfilled cell in clue
for x := i + 1; x < len(state.SelectedClue.Cells); x++ { for x := i + 1; x < len(state.SelectedClue.Cells); x++ {
if state.PuzzleState[state.SelectedClue.Cells[x]] == '-' { if state.PuzzleState[state.SelectedClue.Cells[x]] == '-' {
state.SelectedCell = state.SelectedClue.Cells[x] state.SelectedCell = state.SelectedClue.Cells[x]
break break
} }
} }
} else {
// jump to next cell
if i < len(state.SelectedClue.Cells)-1 {
state.SelectedCell = state.SelectedClue.Cells[i+1]
}
}
} }
if buffer[0] == 0x7f { if buffer[0] == 0x7f {