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

🐛(WinOS) Deno.consoleSize() incorrectly returns console buffer size #23872

Open
rivy opened this issue May 17, 2024 · 0 comments
Open

🐛(WinOS) Deno.consoleSize() incorrectly returns console buffer size #23872

rivy opened this issue May 17, 2024 · 0 comments

Comments

@rivy
Copy link
Contributor

rivy commented May 17, 2024

for all versions of deno since at least 1.21.0

Deno.consoleSize() is incorrectly returning the console buffer size instead of the console window size. This can be seen when using the usual console window (not 'Windows Terminal').

Screenshot 2024-05-17 135307

I hadn't noticed this issue earlier because I primarily use 'Windows Terminal' which maintains its own scrollback buffer and allocates a console screen buffer which is the same size as the console view window. Additionally, most allocated consoles only reserve extra lines for the screen buffer, not extra columns. And most uses only care about the column width of the screen. As a result, Deno.consoleSize() has been accidentally correct for the majority of users and cases, likely since inception (#6520).

The error is in runtime/ops/tty/rs:

deno/runtime/ops/tty.rs

Lines 273 to 276 in d64921c

Ok(ConsoleSize {
cols: bufinfo.dwSize.X as u32,
rows: bufinfo.dwSize.Y as u32,
})

It's an easy fix. I'll post a PR for the fix in a few minutes.

rivy added a commit to rivy-fix/deno that referenced this issue May 17, 2024
@rivy rivy changed the title 🐛 (WinOS) Deno.consoleSize() incorrectly returns console buffer size 🐛(WinOS) Deno.consoleSize() incorrectly returns console buffer size May 18, 2024
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

No branches or pull requests

1 participant