Say what a sheet leaves out, and cut it to what the device can show - #657
Merged
Conversation
A sheet past the html limits was truncated with nothing on screen to say so, which is what a free 2 star of 23 Aug reported as "won't load more than 10,000 lines". odrcore 6.11.0 added HtmlView.sheetCut(), so the app can now name what was left out: CoreLoader carries the core's own answer on HostedView, it rides through LoadedDocument beside the part titles, and DocumentFragment raises a bar for the sheet on screen - "Showing the first 5,000 of 20,000 rows" - taking it down again when the reader moves to a sheet that is whole. The limit itself was measured and is now the device's, in SpreadsheetBudget: 50,000 cells below 3 GB of memory, 100,000 below 6 GB, 150,000 above. It was 500,000 for every phone. That is a cut rather than a raise because the budget is the WebView's, not the core's. Measured on a 2 GB API 31 emulator and an 8 GB API 36 one, a rendered cell costs 10-20 KB in the renderer process against some 226 bytes of html: the 4.5 MB odr-public register renders 500,000 cells as 113 MB of html, which climbs to 4.7 GB in the renderer on the big device - and on the small one the load dies mid-stream after 80 seconds and the user is told the file could not be opened. A limit above what can be laid out does not show more of the document, it shows none of it. Which is also why there is no button offering to relax the cut, as #637 proposed: there is no step between what is rendered and what the sheet holds that a phone survives. The lever that would move the ceiling is core-side and filed as OpenDocument.core#822 - 55% of a sheet's html is style attributes drawn from 26 distinct strings. Measurements and the failure modes are in the issue. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BG8LdxWJMbkZXwurh91Wu2
The measurements and the failure modes belong in the commit and the issue, not in the source. What is left says what the reader of the code needs. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0132LKna2nBJTFJKKq3J6fCe
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.
Closes #637, in the shape the measurement on that issue left it: the app says what a sheet leaves out, and leaves out less of it — but there is no button offering to relax the cut, because nothing a phone can do lies behind one.
What a reader sees
A sheet the budget cut raises a bar naming the numbers, for the sheet on screen and again when a tab is selected; moving to a sheet that is whole takes it down. Both verified on a 2 GB device, where the budget is 50,000 cells:
Columns get their own string, and a sheet cut both ways gets one naming both. The numbers are
HtmlView.sheetCut()'s — the extent the cells span against the extent the markup carries — grouped for the reader's locale.What the limit is now
SpreadsheetBudgetanswers per device: 50,000 cells below 3 GB of memory, 100,000 below 6 GB, 150,000 above, against 500,000 for every phone before.ROWS/COLUMNSstill bound the two directions on their own.It is a cut rather than the raise the issue proposed because the budget is the WebView's, not the core's. Measured on a 2 GB API 31 emulator and an 8 GB API 36 one:
A rendered cell costs 10-20 KB in the renderer against some 226 bytes of html, so a limit above what can be laid out does not show more of the document — it shows none of it. The full ladder, both devices and the failure modes are in the comment on #637.
The lever that would move the ceiling itself is core-side, and filed as opendocument-app/OpenDocument.core#822: 55% of a sheet's html is
styleattributes drawn from 26 distinct strings, and inline style is the one shape a browser engine cannot share between elements. If that lands, these steps are worth measuring again.Shape of the change
SheetCut— parcelable, four numbers, the core's own answer.CoreLoader.host()puts it onHostedView;render()carries it intoLoadedDocument.partCuts, running alongsidepartTitles/partUriswith a null for every part that is whole.SpreadsheetBudgetreplaces the three constants inCoreLoader, withcellsFor(totalMemoryBytes, isLowRamDevice)split out so the ladder is a unit test rather than a shelf of phones.DocumentFragment.reportSheetCutraises and dismisses the bar;SnackbarHelpergrew a message overload, since this is the first bar whose text carries numbers.Nothing new is a setting: per CLAUDE.md, how a document is displayed is answered over the document, and this one is not even that — it is what the device can hold.
Checks
spotlessCheck,lintProDebug,assembleDebug,testProDebugUnitTest, andconnectedProDebugAndroidTeston a 2 GB API 31 emulator: 91 tests, the threeLandingTestsfailures pre-existing on unmodifiedmainon that AVD (swipe, undo and intro on the landing list — checked by stashing the change and running them again).New tests:
SpreadsheetBudgetTestfor every step of the ladder,CoreTest.aSheetPastTheBudgetSaysWhatItLeftOut(a csv generated to the device's own budget, since a fixture big enough on one device is too small on the next) andaSheetInsideTheBudgetReportsNoCut, plus the cut throughDocumentParcelTest.🤖 Generated with Claude Code