* Constructs a new instance. * * @param on What side of the terminal the line should be on.
(on: "top" | "bottom" = "bottom")
| 53 | * @param on What side of the terminal the line should be on. |
| 54 | */ |
| 55 | constructor(on: "top" | "bottom" = "bottom") { |
| 56 | this.#atTop = on === "top"; |
| 57 | this.#lines = this.#atTop ? linesAtTop : linesAtBottom; |
| 58 | this.#lines.push(this.#id); |
| 59 | const top = linesAtTop.length + 1; |
| 60 | const bottom = getRows() - linesAtBottom.length; |
| 61 | write( |
| 62 | (this.#atTop ? "" : Ansi.shiftUpAndInsert()) + |
| 63 | Ansi.setScrollableRegion(top, bottom) + |
| 64 | Ansi.setCursorPosition(bottom), |
| 65 | ); |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Overwrites the contents of the line. |