Skip to content
This repository has been archived by the owner on Mar 26, 2022. It is now read-only.

Automatically find the terminal size #1

Open
torch2424 opened this issue May 13, 2019 · 0 comments
Open

Automatically find the terminal size #1

torch2424 opened this issue May 13, 2019 · 0 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@torch2424
Copy link
Owner

For a full screen matrix effect.

Attempted solutions

First I tried getting the $LINES and $COLUMNS, but I guess that is not supported in programs.

Doing some more researc, seems C programs seem to use ioctl or termios to do this: https://stackoverflow.com/questions/1022957/getting-terminal-width-in-c . However, in WASI we don't have this.

Then, I realized I can do a hack, and use an ANSI code to move the cursor alllll the way to the bottom right, then use another ANSI code, that replies with the current cursor position. this works!

However, I can't read the stdin where the response goes, without pressing enter. And to read without pressing enter, requires going into "non-canonical" mode (A.K.A raw mode). Which, doesn't seem to be able to be done, without ioctl or termios :(

See my fustration at: eb51dab

Which has nice links to the POSIX behind the scenes on how this could be implemented.

This problem mostly steams from me not being able to find docs on how to implement an ioctl or termios API.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant