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

Restoring the buffer #25

Open
tcurdt opened this issue Jul 28, 2024 · 1 comment
Open

Restoring the buffer #25

tcurdt opened this issue Jul 28, 2024 · 1 comment

Comments

@tcurdt
Copy link

tcurdt commented Jul 28, 2024

In Terminal window with the height of 10 - what's the expected result?

	n := 50
	for i := 0; i < n; i++ {
		fmt.Printf("foo-%d\n", i)
	}
	cursor.Up(n)

I am getting

$ go run test.go
foo-0
foo-1
foo-2
foo-3
foo-4
foo-5
foo-6
foo-7
foo-8
foo-9
foo-10
foo-11
foo-12
foo-13
foo-14
foo-15
foo-16
foo-17
foo-18
foo-19
foo-20
foo-21
foo-22
foo-23
foo-24
foo-25
foo-26
foo-27
foo-28
foo-29
foo-30
foo-31
foo-32
foo-33
foo-34
foo-35
foo-36
foo-37
foo-38
foo-39
foo-40
$

Same with UpAndClear(n).

I suspect that's more an ANSI thing rather than the libraries fault.
But is there a way to better deal with that?

@tcurdt tcurdt changed the title Restoring a the buffer Restoring the buffer Jul 28, 2024
@MarvinJWendt
Copy link
Member

Yes, the cursor cannot go out of the terminals boundaries.

You could try to enable the alternative buffer mode (https://gist.github.com/ConnerWill/d4b6c776b509add763e17f9f113fd25b#common-private-modes). When you disable it, its content gets deleted. This is currently not supported by cursor, as not every terminal supports it. But I am thinking about adding the feature, as it should be fine if we document it correctly.

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

2 participants