Closed Zorgatone closed 8 years ago
I haven't tasted on Linux, but my guess is that unix/POSIX terminal with that escape code will do the same effect
About this I saw another project (based on NodeJS) which seems to clear the screen correctly. It works in tty raw mode, and actually resets the screen completely on OS X at least.
https://github.com/substack/node-charm/blob/master/index.js#L110
Maybe we could use the same excape
resets the screen on iTerm, which appears to lack support for the reset character.
Is there a different terminal (emulator(?)) on OSX you could test this on, @Zorgatone?
I have to get on my office machine. But yes I tested and I could see the previous screens.
I use both the Terminal.app
default terminal and iTerm2
. I'm not sure on which of them I saw this issue. Maybe it was the latter. I saw in the NodeJS project they are using one more escape character for iTerm
only
Also on Windows, I have issues if I try to clear the screen outside the standard CMD (ie. Git Bash and Cygwin, etc...). :/
(I've tried without winpty
and it doesn't reset. With winpty
it resets only the part after the last prompt)
For non-cmd
usage on Windows you need to define RLUTIL_USE_ANSI
during compilation.
@nabijaczleweli: oh thanks about that.
Anyway I think we could just print that extra ANSI
escape character for iTerm
support. It shouldn't be complicated at all...
Yeah
Isn't there any way to detect ANSI
support on runtime and choose the correct function?
I wouldn't think so, it's thoroughly transparent, AFAICT, and even if it wasn't, there would need to be a list of ANSI-characteristics for a fixed amount of pseudoterminals, which is, let's just say, inconvenient
Uhm, ok
I can confirm the terminal screen buffer doesn't reset either on iTerm
or Terminal.app
on OS X El Capitan
.
If you scroll up you see all the previous states
It does an equivalent of clear
which is not the same of Windows' cls
@Zorgatone Can you test https://github.com/nabijaczleweli/rlutil/commit/b3e4cd4dce289ad983769a8d5de28253c3432cb2?
@nabijaczleweli Nothing works.. The example says press any key to start, prints the first map and exits... Leaving the screen a total mess :scream:
On iTerm
:
TR: ~/repos/rlutil tommaso$ ./example-c
Welcome! Use WASD to move.
Hit any key to start.
#######
..o..o...
...........
#............
#..o..#....#..
#...o......#..#
#..#..........#
#.....@ TR: ~/repos/rlutil tommaso$
On Terminal.app
:
TR:rlutil tommaso$ ./example-c
Welcome! Use WASD to move.
Hit any key to start.
#######
..o..o...
...........
#............
#..o..#....#..
#...o......#..#
#..#..........#
#.....@TR:rlutil tommaso$ wsdsadasd
#.o.#.o..#....#
#...<#......o.#
#..oo.#.o..#..
#........#oo#
.#.........
o.o..#..#
#######
Coins: 0
Torch: 30
Moves: 0
Level: 1
Does it work on current master
(both work for me on WIndooze, Ubuntu 14 no X, Ubuntu 14 over SSH)?
I'd just v0v at it, because ~Mac~, but...
I'll be on a Mac again tomorrow morning
Solved by #21 (at least on OS X).
Need to check on Linux
In OS X I'm able to see all the example's screens (which should have been cleared) when I scroll my terminal upwards.
Can we portably reset the screen without keeping the old buffer?