MCPcopy
hub / github.com/xtermjs/xterm.js / lineFeed

Method lineFeed

src/common/InputHandler.ts:714–741  ·  view source on GitHub ↗

* LF * Line Feed or New Line (NL). (LF is Ctrl-J). * * @vt: #Y C0 LF "Line Feed" "\n, \x0A" "Move the cursor one row down, scrolling if needed." * Scrolling is restricted to scroll margins and will only happen on the bottom line. * * @vt: #Y C0 VT "Verti

()

Source from the content-addressed store, hash-verified

712 * @vt: #Y C0 FF "Form Feed" "\f, \x0C" "Treated as LF."
713 */
714 public lineFeed(): boolean {
715 this._dirtyRowTracker.markDirty(this._activeBuffer.y);
716 if (this._optionsService.rawOptions.convertEol) {
717 this._activeBuffer.x = 0;
718 }
719 this._activeBuffer.y++;
720 if (this._activeBuffer.y === this._activeBuffer.scrollBottom + 1) {
721 this._activeBuffer.y--;
722 this._bufferService.scroll(this._eraseAttrData());
723 } else if (this._activeBuffer.y >= this._bufferService.rows) {
724 this._activeBuffer.y = this._bufferService.rows - 1;
725 } else {
726 // There was an explicit line feed (not just a carriage return), so clear the wrapped state of
727 // the line. This is particularly important on conpty/Windows where revisiting lines to
728 // reprint is common, especially on resize. Note that the windowsMode wrapped line heuristics
729 // can mess with this so windowsMode should be disabled, which is recommended on Windows build
730 // 21376 and above.
731 this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!.isWrapped = false;
732 }
733 // If the end of the line is hit, prevent this action from wrapping around to the next line.
734 if (this._activeBuffer.x >= this._bufferService.cols) {
735 this._activeBuffer.x--;
736 }
737 this._dirtyRowTracker.markDirty(this._activeBuffer.y);
738
739 this._onLineFeed.fire();
740 return true;
741 }
742
743 /**
744 * CR

Callers 1

constructorMethod · 0.95

Calls 5

_eraseAttrDataMethod · 0.95
markDirtyMethod · 0.65
scrollMethod · 0.65
getMethod · 0.65
fireMethod · 0.45

Tested by

no test coverage detected