Skip to content

fix: logendx off-by-one in rasterize_core log-end tracking#2919

Open
deths74r wants to merge 1 commit intodankamongmen:masterfrom
deths74r:fix/logendx-off-by-one
Open

fix: logendx off-by-one in rasterize_core log-end tracking#2919
deths74r wants to merge 1 commit intodankamongmen:masterfrom
deths74r:fix/logendx-off-by-one

Conversation

@deths74r
Copy link
Copy Markdown

Summary

The condition for updating logendy/logendx in rasterize_core() uses strict greater-than for the x comparison:

(int)x > nc->rstate.logendx

When both logendy and logendx are 0 (cursor at origin, as set by NCOPTION_PRESERVE_CURSOR), the first rendered cell at position (0,0) evaluates as 0 > 0 which is false. The tracking block is never entered, and the first character's position is never recorded in logendy/logendx.

This causes the post-render cursor to park ON the first character instead of after it.

Fix

Change > to >= so the first cell at the origin is properly tracked.

The condition for updating logendy/logendx used strict greater-than
for the x comparison:

  (int)x > nc->rstate.logendx

When both logendy and logendx are 0 (cursor at origin), the first
rendered cell at (0,0) evaluates as 0 > 0 = false, so the tracking
block is never entered. The first character's position is never
recorded, causing the post-render cursor to park ON the first
character instead of after it.

Fix: change > to >= so the first cell at the origin is tracked.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant