[GH-ISSUE #213] Why doesn't the resize function use the size argument? #49

Closed
opened 2026-03-02 23:44:08 +03:00 by kerem · 2 comments
Owner

Originally created by @aprogramq on GitHub (Oct 11, 2025).
Original GitHub issue: https://github.com/anomalyco/opentui/issues/213

Hi, sorry for my possibly stupid question, but I don't understand why the resize function in the TerminalConsole class doesn't use the width and height arguments. Thanks in advance.

public resize(width: number, height: number): void {
    this._updateConsoleDimensions()

    if (this.frameBuffer) {
      this.frameBuffer.resize(this.consoleWidth, this.consoleHeight)

      const displayLineCount = this._displayLines.length
      const logAreaHeight = Math.max(1, this.consoleHeight - 1)
      const maxScrollTop = Math.max(0, displayLineCount - logAreaHeight)
      this.scrollTopIndex = Math.min(this.scrollTopIndex, maxScrollTop)
      this.isScrolledToBottom = this.scrollTopIndex === maxScrollTop
      const visibleLineCount = Math.min(logAreaHeight, displayLineCount - this.scrollTopIndex)
      this.currentLineIndex = Math.max(0, Math.min(this.currentLineIndex, visibleLineCount - 1))

      if (this.isVisible) {
        this.markNeedsRerender()
      }
    }
  }
Originally created by @aprogramq on GitHub (Oct 11, 2025). Original GitHub issue: https://github.com/anomalyco/opentui/issues/213 Hi, sorry for my possibly stupid question, but I don't understand why the resize function in the TerminalConsole class doesn't use the width and height arguments. Thanks in advance. ``` public resize(width: number, height: number): void { this._updateConsoleDimensions() if (this.frameBuffer) { this.frameBuffer.resize(this.consoleWidth, this.consoleHeight) const displayLineCount = this._displayLines.length const logAreaHeight = Math.max(1, this.consoleHeight - 1) const maxScrollTop = Math.max(0, displayLineCount - logAreaHeight) this.scrollTopIndex = Math.min(this.scrollTopIndex, maxScrollTop) this.isScrolledToBottom = this.scrollTopIndex === maxScrollTop const visibleLineCount = Math.min(logAreaHeight, displayLineCount - this.scrollTopIndex) this.currentLineIndex = Math.max(0, Math.min(this.currentLineIndex, visibleLineCount - 1)) if (this.isVisible) { this.markNeedsRerender() } } } ```
kerem 2026-03-02 23:44:08 +03:00
Author
Owner

@kommander commented on GitHub (Oct 11, 2025):

It probably should, it uses renderer.terminalWidth/Height to update dimensions currently. Haven't touched that in a while.

<!-- gh-comment-id:3393146632 --> @kommander commented on GitHub (Oct 11, 2025): It probably should, it uses `renderer.terminalWidth/Height` to update dimensions currently. Haven't touched that in a while.
Author
Owner

@aymuos15 commented on GitHub (Nov 1, 2025):

Could I be assigned to this please?

<!-- gh-comment-id:3476296041 --> @aymuos15 commented on GitHub (Nov 1, 2025): Could I be assigned to this please?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/opentui#49
No description provided.