MCPcopy Create free account
hub / github.com/breck7/scroll / findViewIndex

Function findViewIndex

external/.scrollLibs.js:4418–4433  ·  view source on GitHub ↗
(cm, n)

Source from the content-addressed store, hash-verified

4416 // Find the view element corresponding to a given line. Return null
4417 // when the line isn't visible.
4418 function findViewIndex(cm, n) {
4419 if (n >= cm.display.viewTo) {
4420 return null
4421 }
4422 n -= cm.display.viewFrom
4423 if (n < 0) {
4424 return null
4425 }
4426 var view = cm.display.view
4427 for (var i = 0; i < view.length; i++) {
4428 n -= view[i].size
4429 if (n < 0) {
4430 return i
4431 }
4432 }
4433 }
4434
4435 function updateSelection(cm) {
4436 cm.display.input.showSelection(cm.display.input.prepareSelection())

Callers 5

findViewForLineFunction · 0.85
regLineChangeFunction · 0.85
viewCuttingPointFunction · 0.85
adjustViewFunction · 0.85
.scrollLibs.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected