Skip to content

fix(ui): the Script pane marks a stop at the start of a wrapped row on that row, and tidy its run queue (#2940) - #2985

Merged
jgregoriorincon merged 1 commit into
opengeos:mainfrom
jgregoriorincon:script-wrapped-row-2940
Nov 26, 2026
Merged

jgregoriorincon merged 1 commit into
opengeos:mainfrom
jgregoriorincon:script-wrapped-row-2940

Conversation

@jgregoriorincon

@jgregoriorincon jgregoriorincon commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #2940

What changed

When a Script run stops at a JSON error whose column is the first character of a wrapped row, the underline, the caret a click on the error sets, and the scroll target now sit on that row (the cursor prefers the next row at the break), not at the end of the row above.

Also, from #2820's "Not in this PR", without a visible change I could reproduce:

  • In the frame a key is typed in the box, the stop's mark is not painted and its error is not yet clickable: both were read from the text before the key.
  • The request to scroll to the stop that a click on the error makes is taken every frame, so a key typed right after drops it instead of leaving it for a later stop.
  • A click on the error asks for a repaint explicitly (egui already repaints after a click, so the scroll behaves the same).
  • script_started holds a ScriptStart struct instead of a four-field tuple.
  • json_error_column shares the id split and trimming of script_line through parameters::script_parts.

Reach

Desktop app and browser: the Script pane is the same egui code on both. No new command, parameter, setting or saved data, so the CLI, Python, the Assistant, MCP, plugins and the phone interface are unaffected; json_error_column only feeds the pane's mark. Nothing to undo: it changes how a mark is drawn and where a cursor lands.

Testing

  • a_key_typed_over_a_stop_takes_its_error_click_off_that_frame fails without the change (the error was still clickable in the key's frame). The mark is drawn by the same check; it has no assertion of its own.
  • a_stop_at_the_start_of_a_wrapped_row_is_on_that_row lays out a wrapped line and checks the stop's cursor lands on the second row where a plain one lands on the first.
  • a_scroll_asked_for_a_stop_is_dropped_by_a_key_typed_next fails without that change (the request stayed set).
  • a_scripts_error_says_where_it_stopped gains a multibyte case for json_error_column.
  • checks.sh: fmt, clippy, nextest (9621 passed), doctests, layers and schema check pass.

Manual: narrow the Script pane so layer.rename={"layer":"CCCCCCCCC","n":@} wraps right before the @ (adjust the Cs to the pane's width), Run, then click the error. On main the caret sits at the end of the first row, after the :; with this change it sits at the start of the second row, on the @.

Summary by CodeRabbit

  • Bug Fixes
    • JSON parse errors now point to the correct character position when text includes non-ASCII characters.
    • Clicking an error in wrapped script text now places the cursor on the appropriate visual row and scrolls the error into view.
    • Error highlights and pending scroll behavior are cleared or suppressed when the script text changes, preventing stale indicators.

…n that row, and tidy its run queue (opengeos#2940)

The cursor of a stop's column prefers the next row at a wrap break, so the underline, the caret and the scroll sit on the row it starts. The mark and the error's click are off in the frame a key is typed, a click on the error asks for a repaint, script_started holds a ScriptStart, and json_error_column shares script_line's trimming.
@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change updates JSON error-column calculation and Script pane stop-position behavior. It adds shared script parsing offsets, adjusts stop marks and error navigation at wrapped-row boundaries, and clears or skips pending stop interactions when the script text changes.

Changes: Script error positioning

Layer / File(s) Summary
JSON offsets and error columns
crates/engine/src/parameters.rs, crates/engine/src/cmd/workflows.rs, crates/engine/src/tests.rs
script_parts returns the JSON text and its byte offset in the original line. json_error_column uses that offset, and a test checks that a column after é is counted in characters.
Queued script run records
crates/ui-egui/src/analysispane.rs
The script-start queue uses named ScriptStart fields instead of tuple positions. Queue creation, removal, pending-run checks, and related test setup use the structure.
Stop marks and navigation
crates/ui-egui/src/analysispane.rs
Stop marks and cursor placement account for wrapped-row boundaries. Stop marks and pending scroll requests are skipped or discarded when the script text changes in the frame. Tests cover wrapped-row placement and frame-specific behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Low

Possibly related PRs

  • opengeos/RustGIS#2820: This PR continues the Script pane stopped-line marking and error-click navigation work introduced there.

Suggested reviewers: mavrick-f, giswqs

Merge Risk: Minimal · up to f96f8

This change fixes where the Script pane places JSON error marks and the click-set caret at wrapped-row starts, and it avoids painting stale stop marks after typing. No concrete merge-blocking risk was found, and the change is covered by new tests.

Pre-merge checks: Passed 2 · Inconclusive 2

Failed Failed checks: 2 inconclusive

Check name Status Explanation Resolution
Description check Inconclusive The description follows the template sections: Summary (here 'What changed'), Testing, and UI evidence. The Related issue is given as 'Fixes #2940'. The UI evidence section is not filled with the temp… Fill the '## UI evidence' section. The Script pane mark, caret, and scroll now change on wrapped rows, so the section cannot keep 'No visible UI change.' Attach before and after screenshots of the wrapped-row error (the manual repro in the …
Linked Issues check Inconclusive Linked issue #2940 requires that, for a JSON error column at the first character of a wrapped row, the underline, the click-set caret and the scroll target sit on that row. The changed-file diff for c… Provide the analysispane.rs hunks from merge base to head that set the stop cursor, draw the error underline, handle the error click, and clear the pending scroll. Also provide the body of a_stop_at_the_start_of_a_wrapped_row_is_on_that_row…
Passed Passed checks: 2 passed

Check name Status Explanation
Title check Passed The title names the main change: a Script pane fix so a stop at the start of a wrapped row sits on that row. It also names the secondary run-queue tidy-up. The title is specific and matches the object…
Out of Scope Changes check Passed The whole-PR change set spans four files: workflows.rs, parameters.rs, tests.rs and analysispane.rs. Each change maps to an item in #2940 or the #2820 items it carries. Those items are: the wrapped-ro…
Full details: Title check

Explanation

The title names the main change: a Script pane fix so a stop at the start of a wrapped row sits on that row. It also names the secondary run-queue tidy-up. The title is specific and matches the objectives and the changed files (analysispane.rs, parameters.rs, workflows.rs). It is long at 111 characters, but it is related and clear.

Full details: Out of Scope Changes check

Explanation

The whole-PR change set spans four files: workflows.rs, parameters.rs, tests.rs and analysispane.rs. Each change maps to an item in #2940 or the #2820 items it carries. Those items are: the wrapped-row column, the same-frame stop mark and click, the scroll request handling, the repaint on error click, the ScriptStart struct, and the shared script_parts helper. The tests.rs change adds a multibyte column assertion for json_error_column, which supports the #2940 column requirement. The PR description states that no command, parameter, setting or saved data changes. No change was found that lacks a connection to these items. This result relies on the PR summary and the head file reads, because the analysispane.rs hunks could not be read.

Full details: Description check

Explanation

The description follows the template sections: Summary (here 'What changed'), Testing, and UI evidence. The Related issue is given as 'Fixes #2940'. The UI evidence section is not filled with the template's required 'No visible UI change.' line, but the author states the change is not visible in the same way: the caret and underline move on wrapped rows, which is a visible change. The template asks for before and after screenshots, and none are attached. The description also mixes in the #2820 items without a clear UI evidence statement. The description is mostly complete, but the UI evidence section is missing.

Resolution

Fill the '## UI evidence' section. The Script pane mark, caret, and scroll now change on wrapped rows, so the section cannot keep 'No visible UI change.' Attach before and after screenshots of the wrapped-row error (the manual repro in the description can be used). Also add the template's '## Related issue' wording if needed, and confirm the 'No visible UI change.' line is removed or replaced.

Full details: Linked Issues check

Explanation

Linked issue #2940 requires that, for a JSON error column at the first character of a wrapped row, the underline, the click-set caret and the scroll target sit on that row. The changed-file diff for crates/ui-egui/src/analysispane.rs could not be read: the tool reported that the changed blobs are missing from the checkout. The file read at head returns only the first part of the file. Verified at head: crates/engine/src/cmd/workflows.rs documents the column as 1-based in characters, and json_error_column uses the shared script_parts helper per the PR summary. Verified at head: StoppedAt carries the column, and script_started is a VecDeque of a named ScriptStart struct (#2820 item). Not verified in code: the cursor that prefers the next visual row, the wrapped-row placement of the underline and scroll target, the repaint request on error click, and the same-frame suppression of the stop mark and pending click/scroll. Those rely on the PR description and AI-generated summary only. The test a_stop_at_the_start_of_a_wrapped_row_is_on_that_row is reported but was not read.

Resolution

Provide the analysispane.rs hunks from merge base to head that set the stop cursor, draw the error underline, handle the error click, and clear the pending scroll. Also provide the body of a_stop_at_the_start_of_a_wrapped_row_is_on_that_row. With these, the wrapped-row placement can be confirmed or refuted.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks the script’s next line,
And finds the mark at the right design.
Past wrapped rows, the cursor goes,
To where the JSON error shows.
Then off it bounds, with parsing fine.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: f09b9e94-0330-408d-a73f-b0cf6d23f74d
Commits

Reviewing files that changed from the base of the PR and between 54d7854 and f96f8ae.

Files selected for processing: 4

  • crates/engine/src/cmd/workflows.rs
  • crates/engine/src/parameters.rs
  • crates/engine/src/tests.rs
  • crates/ui-egui/src/analysispane.rs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.

@github-actions

Copy link
Copy Markdown
Contributor

Code review

I read the full diff (4 files, +145/−28), pr-context/AGENTS.md, the PR metadata, and the surrounding code in parameters.rs, workflows.rs and analysispane.rs. I could not run the tests here (no shell), so the results below come from reading the code.

Bugs

None found. I checked:

  • script_parts reproduces the old json_error_column offset arithmetic. start is the byte offset of the JSON text in the untrimmed line, and the is_char_boundary clamp still guards it.
  • The multibyte test expectation (Some(37)) matches a hand count of characters. The old and new code agree on it.
  • script_line still trims before script_parts, so its id and JSON are unchanged for every input.
  • stopped_cursor with prefer_next_row only changes the cursor at a wrap break. Mid-row columns are unchanged, and the mark's width logic still holds.
  • The go_to_stopped request is consumed each frame and dropped when the text changed, as the PR describes.

Confidence: high.

Security

None found. The change only touches cursor placement, mark painting, and error column computation.

Performance

None found. script_parts runs once per script line, and json_error_column runs once per error.

Quality

  • Nit: the stopped gate !response.changed() is applied in two places (analysispane.rs:2296 and :2309) with similar comments. A short helper or one shared comment would read better. Left for the release quality pass.

AGENTS.md

  • Visible change without before/after screenshots. The PR changes where the stop's underline, caret, and scroll target land, and AGENTS.md asks for before and after screenshots in the PR for any visible UI change. The body describes a manual repro and says a screenshot is what would show the mark, but it includes no images. If images were attached outside the body text, disregard this. Confidence: medium-high.

Nothing was left alone from earlier reviews: prior-reviews.json has no threads. I posted no inline comments because no single line rises above nit level.

Change size

Compared with the base branch: the whole PR against main (merge base 4a40b74 to PR head f96f8ae).

Measure Value
Files changed 4 (0 added, 4 modified, 0 removed, 0 renamed)
Size before 3.91 MB
Size after 3.91 MB
Total size change +5.8 KB
Path Before After Change
crates/ui-egui/src/analysispane.rs 186.0 KB 191.3 KB +5.3 KB
crates/engine/src/parameters.rs 11.3 KB 11.9 KB +541 B
crates/engine/src/tests.rs 3.57 MB 3.57 MB +190 B
crates/engine/src/cmd/workflows.rs 143.3 KB 143.1 KB −144 B

@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-2985/
Web app https://preview.rustgis.app/pr-2985/app/
Commit f96f8ae

GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the preview label (once per commit).

@jgregoriorincon
jgregoriorincon marked this pull request as ready for review November 25, 2026 23:29
@github-actions

Copy link
Copy Markdown
Contributor

Code review

I found no bugs, security problems, or AGENTS.md violations. I left no inline comments, since I had no finding worth a thread. No earlier review threads exist on this PR, so there were no concerns to leave alone.

Bugs

None found. I checked:

  • Offset arithmetic in script_parts (crates/engine/src/parameters.rs:35): json is a suffix of trimmed, and trimmed is a slice of line, so start is correct and the subtractions cannot underflow.
  • script_line behaviour is unchanged. The old split_script_id(line) already received a trimmed line.
  • Byte-to-character column conversion in json_error_column (crates/engine/src/cmd/workflows.rs:1584): the byte index is clamped and walked back to a char boundary, and the loop always terminates at 0. I hand-checked the new "é" test: the } is at character 37, which matches the expected Some(37).
  • Stale-mark handling (crates/ui-egui/src/analysispane.rs:2296, :2309): the mark and the error click are suppressed in the frame a key changes the text, when stopped_at was read from the old text. The next frame's hash check hides the mark anyway.
  • go_to_stopped flag: it is set after the box is drawn and consumed on the next frame, so the ordering works. Removing the flag every frame is the intended fix.
  • stopped_cursor with prefer_next_row: it only changes the result at a wrap boundary. Hard newlines and end of text are unaffected.

Confidence: high.

Security

None found. The change only affects how a mark is drawn and where the cursor lands. It adds no input path, command, or parsing of new data.

Performance

None found. The additions are O(1) per frame, plus one request_repaint per click.

Quality

  • ScriptStart fields at and asked are close to the old tuple names, but asked_at and asked in script_ran are a bit hard to tell apart. Left for the release quality pass. Confidence: medium.
  • script_line trims the line and script_parts trims it again. The double trim is harmless. Confidence: high.

AGENTS.md

None found. I checked the no-panic rule (no unwrap/expect/indexing added), the wasm rule (web_time is used, and the desktop-only tests are gated with #[cfg(not(target_arch = "wasm32"))]), the reach statement in the PR body, and that no new command, parameter or saved data was added, so the snapshot, schema and memory files need no update.

Not verified: I have no build or test tool here. I could not confirm that Row::char_count_excluding_newline().0 and CCursor { prefer_next_row, .. } match the locked egui version, or that the new tests pass. The PR body reports checks.sh passing with 9621 tests, which I could not check.

Change size

Compared with main (merge base 4a40b74 to PR head f96f8ae).

Measure Value
Files changed 4 (0 added, 4 modified, 0 removed, 0 renamed)
Size before 3.91 MB
Size after 3.91 MB
Total size change +5.8 KB
Path Before After Change
crates/ui-egui/src/analysispane.rs 186.1 KB 191.3 KB +5.3 KB
crates/engine/src/parameters.rs 11.3 KB 11.9 KB +0.5 KB
crates/engine/src/tests.rs 3.57 MB 3.57 MB +190 B
crates/engine/src/cmd/workflows.rs 143.3 KB 143.1 KB −144 B

@jgregoriorincon
jgregoriorincon added this pull request to the merge queue Nov 25, 2026
Merged via the queue into opengeos:main with commit 8bff5c6 Nov 26, 2026
29 checks passed
@jgregoriorincon
jgregoriorincon deleted the script-wrapped-row-2940 branch November 26, 2026 00:15
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.

[Bug]: Script pane: the error's column at the start of a wrapped row is marked on the row above

1 participant