Skip to content

fix(display): honor pixel-size row offsets - #274

Merged
eval-exec merged 1 commit into
eval-exec:mainfrom
kiennq:pr/window-text-pixel-size-offsets
Aug 21, 2026
Merged

fix(display): honor pixel-size row offsets#274
eval-exec merged 1 commit into
eval-exec:mainfrom
kiennq:pr/window-text-pixel-size-offsets

Conversation

@kiennq

@kiennq kiennq commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Issue

window-text-pixel-size does not support GNU Emacs's (POSITION . Y-OFFSET) input and result shape. Ghostel expects this form and otherwise hits redisplay errors such as (wrong-type-argument listp (0 . 0)); the failure is reproducible on Linux as well as Windows.

Solution

  • Parse (POSITION . Y-OFFSET) and preserve the existing pair result for a zero offset.
  • Convert nonzero pixel offsets into movement across displayed screen rows, including wrapped rows.
  • Return (WIDTH HEIGHT START-POSITION) when offset reporting is requested.
  • Add regressions for negative, zero, positive, and wrapped-row offsets.

Verification

  • cargo test -p neovm-core --lib window_text_pixel_size_ -- --nocapture passes (21 tests).
  • cargo fmt --all -- --check passes.
  • cargo build -p neomacs passes on Windows.

Split from #273 at the maintainer's request.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

It changes redisplay-critical window-text-pixel-size compatibility behavior, including a conditional public return-shape change whose exact GNU Emacs fidelity I could not fully verify, warranting final human review.

Pull request overview

This PR extends the evaluator-backed window-text-pixel-size implementation to honor GNU Emacs's (POSITION . Y-OFFSET) form for the FROM argument. Previously, only the buffer position was consumed and the cdr was merely validated, so callers like Ghostel that pass a pixel offset and expect a (WIDTH HEIGHT START-POSITION) list would hit redisplay errors such as (wrong-type-argument listp (0 . 0)). The change converts a non-zero pixel offset into displayed-screen-row movement (including wrapped rows), reports the adjusted start position, and preserves the legacy (WIDTH . HEIGHT) pair shape for the zero-offset case.

Changes:

  • window_text_pixel_size_from_pos now returns (EmacsBytePos, Option<i64>), extracting a validated non-zero pixel offset from (POSITION . Y-OFFSET).
  • builtin_window_text_pixel_size_ctx converts the pixel offset into signed screen-row movement (capped by accessible size), computes the adjusted start via a new helper, and returns a 3-element list when offset reporting is requested.
  • Adds screen_line_offset_target in symbols.rs, reusing existing forward/backward screen-line motion helpers, plus regression tests for negative, zero, positive, and wrapped-row offsets.
File summaries
File Description
neovm-core/src/emacs_core/xdisp.rs Parses (POSITION . Y-OFFSET), maps pixel offset to screen rows, and returns the GNU-compatible (WIDTH HEIGHT START) list.
neovm-core/src/emacs_core/builtins/symbols.rs Adds screen_line_offset_target to move a signed number of displayed screen lines from a position.
neovm-core/src/emacs_core/xdisp_test.rs Adds four regression tests covering offset shapes and wrapped-row counting.

I verified the row-conversion math (guaranteeing lines is never zero for a non-zero offset), confirmed expect_fixnum_arg prevents the .as_fixnum().expect(...) from panicking, checked that screen_line_offset_target mirrors the existing screen_line_motion_target patterns, confirmed the sole caller of the changed window_text_pixel_size_from_pos signature is updated, and traced the tests against the implementation. I found no concrete objective defects to flag (the only nit, a redundant wid.0 as u64 cast, is non-blocking since neovm-core is not clippy-gated with -D warnings).

Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@eval-exec
eval-exec merged commit 411dffb into eval-exec:main Aug 21, 2026
1 check passed
@eval-exec

Copy link
Copy Markdown
Owner

Merged—thank you. I am following up directly on main with GNU-oracle regressions and fixes for partial positive pixel offsets, final unterminated-row motion, TO clipping order, and the shared display-motion seam. I will keep the follow-up scoped to those compatibility and performance issues.

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.

3 participants