Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling terminal dimension feature #16

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Lgoldfinch
Copy link

No description provided.

Copy link
Contributor

@noelwelsh noelwelsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would benefit from a few tweaks. Also, if you run the build command from sbt that will add copyright headers, do formatting, etc. This is necessary for CI to pass the code.


/** Functionality for getting the dimensions of the terminal */
trait Dimensions extends Writer {
def getDimensions: Unit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want this method to return the dimensions, so something like

def getDimensions(): (Int, Int)

or

def getSize(): Size

where Size is something like

final case class Size(x: int, y: Int)

(or perhaps rows and columns instead of x and y; see what the convention is in the commands that move the cursor around.)

I've used the convention that side effecting methods have empty parameter lists. I.e. def getSize(), not def getSize

/** Functionality for getting the dimensions of the terminal */
trait Dimensions {
object dimensions {
def getDimensions: effect.Dimensions ?=> Unit = effect ?=>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is wrapped in an object named dimensions, we don't need to name the method getDimensions. Just get is fine.

Alternatively it could just be getDimensions without the wrapping object. This is not a method that is going to have a name collision, unlike the methods for setting color and moving the cursor.

@@ -47,6 +46,15 @@ class JLineTerminal(terminal: JTerminal) extends Terminal {
}
}

// Do we need to consider getBufferSize?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea what most of these methods do. The JLine documentation is, unfortunately, not very good.

@Lgoldfinch Lgoldfinch force-pushed the addTerminalDimensions branch from 0c1509a to 263ac4c Compare February 8, 2025 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants