(boundToLine)
| 477 | return lineObj = getLine(doc, l) |
| 478 | } |
| 479 | function moveOnce(boundToLine) { |
| 480 | let next |
| 481 | if (unit == "codepoint") { |
| 482 | let ch = lineObj.text.charCodeAt(pos.ch + (unit > 0 ? 0 : -1)) |
| 483 | if (isNaN(ch)) next = null |
| 484 | else next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (ch >= 0xD800 && ch < 0xDC00 ? 2 : 1))), |
| 485 | -dir) |
| 486 | } else if (visually) { |
| 487 | next = moveVisually(doc.cm, lineObj, pos, dir) |
| 488 | } else { |
| 489 | next = moveLogically(lineObj, pos, dir) |
| 490 | } |
| 491 | if (next == null) { |
| 492 | if (!boundToLine && findNextLine()) |
| 493 | pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir) |
| 494 | else |
| 495 | return false |
| 496 | } else { |
| 497 | pos = next |
| 498 | } |
| 499 | return true |
| 500 | } |
| 501 | |
| 502 | if (unit == "char" || unit == "codepoint") { |
| 503 | moveOnce() |
no test coverage detected