MCPcopy
hub / github.com/hokein/electron-sample-apps / wrappingChanged

Function wrappingChanged

mini-code-editor/cm/lib/codemirror.js:1362–1381  ·  view source on GitHub ↗
(from, to)

Source from the content-addressed store, hash-verified

1360 else lineDiv.parentNode.style.marginLeft = 0;
1361 }
1362 function wrappingChanged(from, to) {
1363 if (options.lineWrapping) {
1364 wrapper.className += " CodeMirror-wrap";
1365 var perLine = scroller.clientWidth / charWidth() - 3;
1366 doc.iter(0, doc.size, function(line) {
1367 if (line.hidden) return;
1368 var guess = Math.ceil(line.text.length / perLine) || 1;
1369 if (guess != 1) updateLineHeight(line, guess);
1370 });
1371 lineSpace.style.width = code.style.width = "";
1372 } else {
1373 wrapper.className = wrapper.className.replace(" CodeMirror-wrap", "");
1374 maxWidth = null; maxLine = "";
1375 doc.iter(0, doc.size, function(line) {
1376 if (line.height != 1 && !line.hidden) updateLineHeight(line, 1);
1377 if (line.text.length > maxLine.length) maxLine = line.text;
1378 });
1379 }
1380 changes.push({from: 0, to: doc.size});
1381 }
1382 function makeTab(col) {
1383 var w = options.tabSize - col % options.tabSize, cached = tabCache[w];
1384 if (cached) return cached;

Callers

nothing calls this directly

Calls 2

charWidthFunction · 0.85
updateLineHeightFunction · 0.85

Tested by

no test coverage detected