fix: don't try to account for alternative castling notation in annotations#2255
Merged
veloce merged 2 commits intolichess-org:mainfrom Oct 14, 2025
Merged
fix: don't try to account for alternative castling notation in annotations#2255veloce merged 2 commits intolichess-org:mainfrom
veloce merged 2 commits intolichess-org:mainfrom
Conversation
…tions This leads annotations being displayed on the wrong square e.g. when moving the rook from e1 to h1 (as its incorecctly interpreted as a castling move). Luckily, we already convert alternative castling notation when constructing the node tree, so instead of extending the logic in the AnalysisBoard, we can just get rid of this logic entirely. Fixes lichess-org#2231
Contributor
|
Thanks for this! A test would be nice here, to avoid any future regression. |
tom-anders
added a commit
to tom-anders/lichess-mobile
that referenced
this pull request
Oct 17, 2025
I wrongly assumed that addMoveAt() already converts castling notation for us, but that function is only called when new nodes are added to the move tree in an active game, but not when parsing a study chapter. This is why lichess-org#2255 fixed the bug of a mve being incorrectly interpreted as alt-castling, but it now broke the annotations if the move actually WAS a castling move. Luckily, while in addMoveAt() there are some heuristics because we only have the UCI move, not the SAN move, in the AnalysisBoard we *do* have the SAN move, so we can just check for O-O/O-O-O to avoid false positives. Resolves lichess-org#2231
veloce
pushed a commit
that referenced
this pull request
Oct 17, 2025
I wrongly assumed that addMoveAt() already converts castling notation for us, but that function is only called when new nodes are added to the move tree in an active game, but not when parsing a study chapter. This is why #2255 fixed the bug of a mve being incorrectly interpreted as alt-castling, but it now broke the annotations if the move actually WAS a castling move. Luckily, while in addMoveAt() there are some heuristics because we only have the UCI move, not the SAN move, in the AnalysisBoard we *do* have the SAN move, so we can just check for O-O/O-O-O to avoid false positives. Resolves #2231
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.
This leads annotations being displayed on the wrong square e.g. when moving the rook from e1 to h1 (as its incorrectly interpreted as a castling move).
Luckily, we already convert alternative castling notation when constructing the node tree here, so instead of extending the logic in the AnalysisBoard, we can just get rid of this logic entirely.
Fixes #2231