gizak / termui

Golang terminal dashboard
MIT License
13.14k stars 787 forks source link

Overwrite lines instead of writing to next line #113

Closed shilch closed 7 years ago

shilch commented 7 years ago

Hi! Thank you for this awesome library!

I have one question regarding the rendering of the UI. When the UI is rendered, all cells are printed out to the next lines. That 'fills' the history of the terminal very soon (see it by scrolling up).

Is it possible to use terminal sequences to overwrite the old lines? Have a look here:

fmt.Print("\033[1A") // move cursor one line up
fmt.Print("\033[K")  // delete till end of line

You can test it out by typing echo "\033[1A\033[1A\033[1A". This 'eats' your lines. I think these sequences are used by the nano editor too.

So, is this possible?

Thank you in advance!

shilch commented 7 years ago

My fault, it is already done this way. I was using a terminal (iTerm 2) that did not support these sequences.