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

Method cursorUp

src/common/InputHandler.ts:902–911  ·  view source on GitHub ↗

* CSI Ps A * Cursor Up Ps Times (default = 1) (CUU). * * @vt: #Y CSI CUU "Cursor Up" "CSI Ps A" "Move cursor `Ps` times up (default=1)." * If the cursor would pass the top scroll margin, it will stop there.

(params: IParams)

Source from the content-addressed store, hash-verified

900 * If the cursor would pass the top scroll margin, it will stop there.
901 */
902 public cursorUp(params: IParams): boolean {
903 // stop at scrollTop
904 const diffToTop = this._activeBuffer.y - this._activeBuffer.scrollTop;
905 if (diffToTop >= 0) {
906 this._moveCursor(0, -Math.min(diffToTop, params.params[0] || 1));
907 } else {
908 this._moveCursor(0, -(params.params[0] || 1));
909 }
910 return true;
911 }
912
913 /**
914 * CSI Ps B

Callers 2

constructorMethod · 0.95
cursorPrecedingLineMethod · 0.95

Calls 1

_moveCursorMethod · 0.95

Tested by

no test coverage detected