Fuse three screens into one
Any real-world terminal implementation needs history and incremental updates, so I think it makes sense to merge pyte.DiffScreen and pyte.HistoryScreen into pyte.Screen.
I'll take a stab at it... For those interested, my fork is here.
Sidenote: now that we have Screen.buffer as defaultdict we can simplify HistoryScreen implementation: store all lines in Screen.buffer and keep track of the current offset within the buffer. The displayed portion of the buffer is offset:offset+lines.
Sidenote: now that we have Screen.buffer as defaultdict we can simplify HistoryScreen implementation: store all lines in Screen.buffer and keep track of the current offset within the buffer. The displayed portion of the buffer is offset:offset+lines.
Oh that would be nice! I'll take a look at it.
I think i've merged DiffScreen and Screen. I pushed the commit here. I stubbed out DiffScreen; it should be backwards compatible. All the tests passed fine.
BTW, how do you generate your docs? I want to make sure what I added looks okay.
If everything else looks good, let me know and I'll submit a PR.
BTW, how do you generate your docs? I want to make sure what I added looks okay.
cd docs
make html
If everything else looks good, let me know and I'll submit a PR.
Sure, go ahead and submit one. I've looked through the commit, it looks OK. Don't forget to add yourself to AUTHORS ;)
I just submitted PR #86.
Hi @broosa, would you have time to work on 'HistoryScreen->Screen' in the upcoming weeks? If not, I might tackle that myself.
I would be sad to see the regular screen go as I use it directly without history (actually I made my own history screen with some optimizations). If anyone wants a screen with diff, history etc. they can just use the HistoryScreen as it is right now or am I missing something ?
The key idea behind this refactoring here is that after migration to defaultdict we can support history in the regular screen with almost zero effort. Therefore there is little need for a specialized subclass.
I see - well in that case I would happily switch to the new all-in-one screen :-)