Fix best move arrow not shown when engine lines set to zero#3100
Merged
veloce merged 1 commit intoMay 4, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: Best move arrow not shown when engine lines is set to 0
When the "Show best move arrow" option was enabled but the number of engine lines was set to 0, the best move arrow was not displayed on the board.
Root cause
In analysis_board.dart, the best moves were filtered using .take(enginePrefs.numEvalLines). When numEvalLines is 0, .take(0) returns an empty list, so no arrow was drawn. This was inconsistent with the UCI protocol layer in uci_protocol.dart, which already uses math.max(1, multiPv) to ensure Stockfish always evaluates at least one line.
Fix
Changed .take(enginePrefs.numEvalLines) to .take(math.max(1, enginePrefs.numEvalLines)) in analysis_board.dart, so that at least the best move is always passed to computeBestMoveShapes() when the engine is running, regardless of the number of displayed lines.
Test
A new test was added to the Engine best move arrow group in analysis_screen_test.dart, verifying that the best move arrow is displayed even when the number of engine lines is set to 0.
Fixes: #2871