Clamp viewport line numbers in getCompletelyVisibleViewRange#295856
Closed
Clamp viewport line numbers in getCompletelyVisibleViewRange#295856
Conversation
…port line numbers Clamp viewport line numbers from viewLayout.getLinesViewportData() to the valid range [1, getLineCount()] in getCompletelyVisibleViewRange() and getCompletelyVisibleViewRangeAtScrollTop(). This prevents out-of-bounds access to modelLineProjections[] when viewport data is stale after a model change. The sibling method getVisibleRangesPlusViewportAboveBelow() already performs this clamping correctly. Fixes #278407ff-ebf2-a32b-7ba2-246abc37bf68 Co-authored-by: bryanchen-d <41454397+bryanchen-d@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix unhandled error reading properties of undefined
Clamp viewport line numbers in getCompletelyVisibleViewRange
Feb 17, 2026
Member
|
Let's close in favor of #296709 |
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.
getCompletelyVisibleViewRange()andgetCompletelyVisibleViewRangeAtScrollTop()use line numbers fromviewLayout.getLinesViewportData()without clamping, causingCannot read properties of undefined (reading 'getViewLineMinColumn')when viewport data is stale after a model change (e.g., during editor input transitions triggeringupdateOptions→ config change →mainThreadEditorreading visible ranges).The sibling method
getVisibleRangesPlusViewportAboveBelow()already clamps correctly. Applied the sameMath.max(1, ...)/Math.min(this.getLineCount(), ...)pattern to both methods.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
redirector.gvt1.com/proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --crashpad-handler-pid=6743 --enable-crash-reporter=20c4b431-3a5f-48a4-8742-e59c04dc8e8b,no_channel --user-data-dir=/tmp/vscode-tests-1771360825840 --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,8433739414279652828,12731713229849147524,262144 --enable-features=PdfUseShowSaveFilePicker --disable-features=LocalNetworkAccessChecks,ScreenAIOCREnabled,SpareRendererForSitePerProcess,TraceSiteInstanceGetProcessCreation --variations-seed-version --trace-process-track-uuid=3190708989122997041(dns block).build/electron/code-oss .build/electron/code-oss test/unit/electron/index.js --crash-reporter-directory=/home/REDACTED/work/vscode/vscode/.build/crashes --run src/vs/editor/test/browser/viewModel/viewModelImpl.test.ts(dns block)/proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --crashpad-handler-pid=8509 --enable-crash-reporter=20c4b431-3a5f-48a4-8742-e59c04dc8e8b,no_channel --user-data-dir=/tmp/vscode-tests-1771361181084 --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,10414167561713765848,5024585337175371328,262144 --enable-features=PdfUseShowSaveFilePicker --disable-features=LocalNetworkAccessChecks,ScreenAIOCREnabled,SpareRendererForSitePerProcess,TraceSiteInstanceGetProcessCreation --variations-seed-version --trace-process-track-uuid=3190708989122997041 e_modules/.bin/sh Map --inlineSourbash --sourceMap --inlineSources sh(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.