nsf / termbox

Library for writing text-based user interfaces
http://code.google.com/p/termbox
MIT License
1.96k stars 185 forks source link

Clear specified area #91

Closed silversquirl closed 7 years ago

silversquirl commented 7 years ago

It'd be nice to be able to clear only a specific area, as then subroutines that separate off from the main event loop for a bit could be written without needing to re-draw the existing content.

For example, if a program were to have a dialog pop up, it would be nice to be able to let a separate subroutine draw that dialog and handle events for it without the subroutine needing to be aware of the rest of the program state. This is particularly relevant in text entry, where the display needs to be cleared for a character to actually disappear.

This may already be possible and I'm just missing something (it'd be nice to have an IRC channel or something where I can go to check these things).

nsf commented 7 years ago

Well, I don't know. You can double buffer things. You can have buffer per window and then composite them onto termbox's back buffer. Doing surgery in cases like this is irrelevant these days (not 80s right now). Also I believe there is no need to clear termbox's backbuffer at all. Termbox will publish any changes in the backbuffer since the last publication. So just write there anything you need any way you like. struct tb_cell is a public structure and it's not an accident, you can make your own buffers and manage them.

silversquirl commented 7 years ago

Oh, I hadn't thought of that. Thanks!