1

I want to be tailing a file and at the same time provide an overlay with keys that can be pressed.

How can I make sure that data will be displayed and updated immediately? I hope it wouldn't have to redraw the keys at the bottom all the time. I also prefer not to have to buffer the tails, but see them immediately.

Basically, the bottom few lines should be reserved for the keys.

Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
PascalVKooten
  • 20,643
  • 17
  • 103
  • 160

1 Answers1

1

Use a csr terminal sequence to change the scroll region. In Blessed this would be something like:

import sys
import blessed

term = blessed.Terminal()
sys.stdout.write(term.move(term.height, 0))
sys.stdout.write(term.clear_eol + 'This text stays put')
sys.stdout.write(term.csr(0, term.height - 3))
sys.stdout.write(term.move(term.height - 3, 0))
for line in range (1, 11):
    print('Reading line %d' % line)

Version 2 of Blessed will be released soon and that might change the code a little.

aviso
  • 2,371
  • 1
  • 14
  • 15