Implement the Dimensions effect for xterm.js.#34
Merged
noelwelsh merged 5 commits intocreativescala:mainfrom May 15, 2025
Merged
Implement the Dimensions effect for xterm.js.#34noelwelsh merged 5 commits intocreativescala:mainfrom
noelwelsh merged 5 commits intocreativescala:mainfrom
Conversation
noelwelsh
requested changes
May 13, 2025
Contributor
noelwelsh
left a comment
There was a problem hiding this comment.
Looks good apart from one change.
| } | ||
| type Program[A] = Terminal ?=> A | ||
|
|
||
| object Terminal extends Color, Cursor, Format, Erase, Writer { |
Contributor
There was a problem hiding this comment.
I think this should extend Dimensions
…nd rely on the one inherited from the Dimensions trait
Contributor
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #24: Implement Dimensions effect for xterm.js
This commit implements the
Dimensionseffect for the xterm.js backend, enabling users to get the terminal's columns and rows, and to resize the terminal.Key Changes:
core/js/src/main/scala/terminus/XtermJsTerminal.scala:def cols: Intdef rows: Intdef resize(cols: Int, rows: Int): Unitcore/js/src/main/scala/terminus/XtermJsOptions.scala:applymethod to ensure a consistent parameter order for dimensions:cols: Int = 80, rows: Int = 24.core/js/src/main/scala/terminus/Terminal.scala:Terminalclass now extends theeffect.Dimensionstrait.getDimensionsto retrieve the current terminal dimensions (TerminalDimensions(terminal.cols, terminal.rows)).setDimensionsto resize the terminal usingterminal.resize(dimensions.columns, dimensions.rows).dimensionshelper object within theTerminalcompanion object for a cleaner API (e.g.,Terminal.dimensions.get).runmethod (that acceptsid,cols,rows) to callXtermJsOptionswith thecolsparameter first, thenrows, maintaining consistency.These changes provide the core functionality requested in issue #24 for the xterm.js environment. The

coreJS/testsuite passes with these modifications.