Skip to content
← Back to Community
Setting the console's buffer height?
Profile icon
SixBeeps

Hey all,

I wanted to post this here before I make a request in the feedback Canny to make sure this isn't already a thing.

I'm writing an application that relies on setting the cursor position to various points on the screen. However, in trying to set the cursor position to somewhere lower than 24 vertically (what I assume is Repl.it's default buffer height), I get an error saying that the position is out of range (see below)

Normally, this would be solved by changing the Console.BufferHeight property, but that seems to be a Windows-only feature.

So, is there any way to change this, or will I have to just make a new ticket to get it extended? Thanks in advance.

Unhandled Exception: System.ArgumentOutOfRangeException: Value must be positive and below the buffer height. Parameter name: top at System.TermInfoDriver.SetCursorPosition (System.Int32 left, System.Int32 top) [0x0003e] in <d13c8b563008422a8c5aaec0a74089cc>:0 at System.ConsoleDriver.SetCursorPosition (System.Int32 left, System.Int32 top) [0x00000] in <d13c8b563008422a8c5aaec0a74089cc>:0 at System.Console.SetCursorPosition (System.Int32 left, System.Int32 top) [0x00000] in <d13c8b563008422a8c5aaec0a74089cc>:0 at MainClass.Goto (System.Int32 x, System.Int32 y) [0x00000] in <a34b7a8db01247f8ad56f06dc506fe67>:0 at MainClass.DrawBoard (System.Boolean[,] guess, System.Boolean[,] answer, System.Int32 size) [0x00168] in <a34b7a8db01247f8ad56f06dc506fe67>:0 at MainClass.Main (System.String[] args) [0x00140] in <a34b7a8db01247f8ad56f06dc506fe67>:0 [ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentOutOfRangeException: Value must be positive and below the buffer height. Parameter name: top at System.TermInfoDriver.SetCursorPosition (System.Int32 left, System.Int32 top) [0x0003e] in <d13c8b563008422a8c5aaec0a74089cc>:0 at System.ConsoleDriver.SetCursorPosition (System.Int32 left, System.Int32 top) [0x00000] in <d13c8b563008422a8c5aaec0a74089cc>:0 at System.Console.SetCursorPosition (System.Int32 left, System.Int32 top) [0x00000] in <d13c8b563008422a8c5aaec0a74089cc>:0 at MainClass.Goto (System.Int32 x, System.Int32 y) [0x00000] in <a34b7a8db01247f8ad56f06dc506fe67>:0 at MainClass.DrawBoard (System.Boolean[,] guess, System.Boolean[,] answer, System.Int32 size) [0x00168] in <a34b7a8db01247f8ad56f06dc506fe67>:0 at MainClass.Main (System.String[] args) [0x00140] in <a34b7a8db01247f8ad56f06dc506fe67>:0
Voters
Profile icon
SixBeeps
Comments
hotnewtop
Profile icon
Coder100

yeah, the signature appears to look like this:

public static int BufferHeight { get; }

how unfortuante.

Intuitively, this makes sense because if you change the width, repl.it would have to change the terminal width, meaning exterm would have to recognize that, which I don't think it does

rip

another reason to not use C# here xd

Profile icon
SixBeeps

@Coder100
I swear Repl.it is like a really good bar, but they serve the worst margaritas, and I want a good margarita.

Though, would exterm have to recognize it? Couldn't it just, like, ignore the change?

Profile icon
Coder100

lol yeah
well I mean if they ignore the change, the window won't resize lol


@SixBeeps

Profile icon
SixBeeps

@Coder100
I'm not looking to resize the window though.
The problem is that the console window is big enough to put the cursor where I want to put it, but it won't let me. Here's a diagram:

image

Profile icon
Coder100

ohhh, well the thing is curses is glitching for me too where part of it doesn't even print, I think you and I have found a bug pog

@SixBeeps

Profile icon
SixBeeps

@Coder100
Ok but here's the weird part: I can still print beyond the buffer line. Like if I set the cursor to just before it and print a few lines they show up.

Profile icon
Coder100