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

Handle user updating the width of their window dynamically #34

Open
bitspittle opened this issue Aug 29, 2021 · 6 comments
Open

Handle user updating the width of their window dynamically #34

bitspittle opened this issue Aug 29, 2021 · 6 comments
Labels
bug Something isn't working maybe Not sure if we're going to do this issue or not

Comments

@bitspittle
Copy link
Contributor

No description provided.

@bitspittle bitspittle added the bug Something isn't working label Aug 29, 2021
@bitspittle bitspittle added this to the 1.0 milestone Aug 29, 2021
@bitspittle bitspittle added the maybe Not sure if we're going to do this issue or not label Sep 13, 2021
@bitspittle
Copy link
Contributor Author

This might not be possible. I can't seem to find ways to either

  1. stop the terminal from autowrapping my lines
  2. ask the terminal its width in a consistent manner
  3. ask the terminal to tell me when it added a newline

There may be a way and it's probably worth leaving this bug open, but not necessarily as a 1.0 milestone. My experimentation with other dynamic CLIs is they suffer a similar fate.

@bitspittle
Copy link
Contributor Author

Actually, the "$COLUMNS" variable in Linux seems to work. With seeing if this is standard-enough behavior that we can use it consistently.

@bitspittle
Copy link
Contributor Author

It's still quite tricky to get the width. It's a shame either jline doesn't support this OR it does but I can't find it. (jline's terminal.getSize() doesn't update dynamically as you resize the window)

See also: https://stackoverflow.com/questions/1286461/can-i-find-the-console-width-with-java/18883172#18883172

bitspittle added a commit that referenced this issue Sep 13, 2021
... when doing "repaint the active block" calculations.

Bug #34
@bitspittle bitspittle removed this from the 1.0 milestone Sep 13, 2021
@bitspittle
Copy link
Contributor Author

Leaving the bug open because we still don't handle dynamic window resizing, and I'd like to think that's possible someday. But for now, at least we take initial window size into account, which is better than nothing, so I'm going to remove the 1.0 milestone from this bug.

bitspittle added a commit that referenced this issue Sep 17, 2021
... when doing "repaint the active block" calculations.

Bug #34
@bitspittle
Copy link
Contributor Author

I'm going to close this as dynamic window resizing just doesn't seem like something that consoles are good at.

@bitspittle
Copy link
Contributor Author

Now that I have a bunch of K/N code, I'm actually going to reopen this and check one more time to make sure.

Really, what I need is an event that the column changed (or maybe I can poll this every frame).

I'm pretty sure I tried polling when using Jline, but I should try again now that I've got K/N solutions.

@bitspittle bitspittle reopened this Mar 22, 2023
@bitspittle bitspittle changed the title Handle repaint issues when terminal windows are too thin Handle user updating the width of their window dynamically Mar 22, 2023
bitspittle added a commit that referenced this issue Jun 12, 2023
Also, fix issue with widths / heights not updating dymically.

Fixes #34
Fixes #94
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working maybe Not sure if we're going to do this issue or not
Projects
None yet
Development

No branches or pull requests

1 participant