MCPcopy
hub / github.com/DHTMLX/gantt / moveOnce

Function moveOnce

samples/common/codehighlight/codemirror.js:8677–8701  ·  view source on GitHub ↗
(boundToLine)

Source from the content-addressed store, hash-verified

8675 return lineObj = getLine(doc, l)
8676 }
8677 function moveOnce(boundToLine) {
8678 var next;
8679 if (unit == "codepoint") {
8680 var ch = lineObj.text.charCodeAt(pos.ch + (dir > 0 ? 0 : -1));
8681 if (isNaN(ch)) {
8682 next = null;
8683 } else {
8684 var astral = dir > 0 ? ch >= 0xD800 && ch < 0xDC00 : ch >= 0xDC00 && ch < 0xDFFF;
8685 next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (astral ? 2 : 1))), -dir);
8686 }
8687 } else if (visually) {
8688 next = moveVisually(doc.cm, lineObj, pos, dir);
8689 } else {
8690 next = moveLogically(lineObj, pos, dir);
8691 }
8692 if (next == null) {
8693 if (!boundToLine && findNextLine())
8694 { pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir); }
8695 else
8696 { return false }
8697 } else {
8698 pos = next;
8699 }
8700 return true
8701 }
8702
8703 if (unit == "char" || unit == "codepoint") {
8704 moveOnce();

Callers 1

findPosHFunction · 0.85

Calls 4

moveVisuallyFunction · 0.85
moveLogicallyFunction · 0.85
findNextLineFunction · 0.85
endOfLineFunction · 0.85

Tested by

no test coverage detected