Skip to content

Conversation

@eikomaniac
Copy link
Collaborator

Description

skips smooth caret animation when moving to a new line

@eikomaniac eikomaniac requested a review from Miodec January 17, 2026 20:29
@eikomaniac eikomaniac self-assigned this Jan 17, 2026
Copilot AI review requested due to automatic review settings January 17, 2026 20:29
@monkeytypegeorge monkeytypegeorge added the frontend User interface or web stuff label Jan 17, 2026
@github-actions github-actions bot added the waiting for review Pull requests that require a review before continuing label Jan 17, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR disables smooth caret animation when transitioning between lines to prevent the caret from visibly "flying" across the screen during line changes.

Changes:

  • Added line change detection using isLineChange flag and previousWordTop tracking
  • Modified animation logic to skip smooth animations during line transitions
  • Updated position calculation to return wordTop for line change detection

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

this.readyToResetMarginTop = false;
this.readyToResetMarginLeft = false;
this.cumulativeTapeMarginCorrection = 0;
this.previousWordTop = -1;
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previousWordTop reset is missing initialization in the constructor. While it's reset here in what appears to be a reset method, the field should also be initialized in the constructor at line 46 for consistency with other private fields.

Copilot uses AI. Check for mistakes.
Comment on lines +397 to +399
if (this.previousWordTop !== -1 && wordTop !== this.previousWordTop) {
this.isLineChange = true;
}
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The isLineChange flag is set to true but never reset to false before the next position update in some code paths. If options.animate is false at line 409, the flag is reset at line 414, but if the condition at line 397 triggers multiple times before reaching line 414, the flag state could be incorrect for subsequent updates within the same animation frame.

Copilot uses AI. Check for mistakes.
// affect the position animations

// skip the next smooth caret animation to prevent the caret from
// flying across the screen when transitioning to a new line
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting isLineChange = true in handleLineJump without any corresponding reset within this method creates an implicit dependency on the reset happening elsewhere (line 414). Consider adding a comment explaining that this flag is reset in the updatePosition method, or refactor to make the lifecycle of this flag more explicit and easier to maintain.

Suggested change
// flying across the screen when transitioning to a new line
// flying across the screen when transitioning to a new line
// note: this flag is reset in updatePosition to avoid affecting subsequent animations

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend User interface or web stuff waiting for review Pull requests that require a review before continuing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants