Repository navigation
fix(sheet): give head-row handler contexts their real row index - #1234
Open
Sean-Walker0 wants to merge 1 commit into
Open
Sean-Walker0 wants to merge 1 commit into
Sean-Walker0 wants to merge 1 commit into
Conversation
Sean-Walker0
force-pushed
the
fix/head-row-handler-index
branch
2 times, most recently
from
October 29, 2026 22:52
1f02d86 to
5b663be
Compare
Sean-Walker0
force-pushed
the
fix/head-row-handler-index
branch
4 times, most recently
from
November 11, 2026 11:27
175b2ee to
ab31a8e
Compare
initHead created the row handler context for every head row with the same starting row index instead of the loop's row index, so for a multi-row head all head rows reported the first head row's index (a two-row head reported rowIndex=0 twice while relativeRowIndex said 0 then 1). Any RowWriteHandler that keys on getRowIndex() - custom position checks, per-row styling, marker writes - saw wrong indexes for every head row after the first. Data-row contexts were already correct. Pass the loop's row index. Verified with HeadRowHandlerContextTest (head rows report [0, 0] before the change and [0, 1] after; data rows 2 and 3 pinned on both sides), the unchanged WriteHandlerTest call-matrix suite, the full fesod-sheet suite (1119 tests) and spotless:check.
Sean-Walker0
force-pushed
the
fix/head-row-handler-index
branch
from
November 23, 2026 07:38
ab31a8e to
004d6df
Compare
This branch has not been deployed
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.
Purpose of the pull request
When writing a multi-row head,
WriteContextImpl.initHeadcreated theRowWriteHandlerContextfor every head row with the same starting row index instead of the loop's row index. A two-row head reportedrowIndex=0twice (whilerelativeRowIndexcorrectly said 0 then 1), a three-row head reported 0 three times, and so on. AnyRowWriteHandler(or code reached from one) that keys ongetRowIndex()— custom position checks, per-row styling, writing markers or comments at computed positions — saw wrong indexes for every head row after the first. Data-row contexts were already correct.Observed with a registered handler on a 2-row-head write (default settings):
No issue exists for this yet; found while probing handler context values.
What's changed?
The context is now created with the loop's row index
iinstead of the constantnewRowIndex— one line. The physical rows themselves were always written ati(WorkBookUtil.createRow(sheet, i)), so handlers now see the index of the row they are actually observing.Checklist
Verifying this change
HeadRowHandlerContextTest— red before (head rows must report their physical row indexes ==> expected: <[0, 1]> but was: <[0, 0]>), green after; data rows 2 and 3 are pinned on both sides.WriteHandlerTest(the handler call-matrix suite): 23/23 unchanged../mvnw clean package -B -Dmaven.test.skip=false -pl fesod-common,fesod-shaded,fesod-sheet: 1119 tests, 0 failures, 0 errors../mvnw -pl fesod-sheet spotless:check: clean.Notes
RowWriteHandlerContext.getRowIndex()for head rows after the first now reports the real row index. Handlers that (knowingly or not) relied on the constant value would observe different indexes — the old value was inconsistent with the written row and withrelativeRowIndex, so this is the fix's intent.createRowWriteHandlerContextcall site but the index argument flows through either shape and the diffs merge cleanly; feat: add composable annotations support #920/feat: add composable annotation support and meta-annotation processing #1076 touch other regions ofWriteContextImpl.