← Back to team overview

boots-developers team mailing list archive

Re: Understanding terminal's buffer handling

 

Hi Ashish!

You might consider buffering the raw data that you use to construct
the lines. This way when a resize event occurs you can regerate the
lines of any size. I'm guessing you'll want to buffer the entire
result set (possibly with some large upper limit to not run out of
memory) so you can page back and forth with it. Resizing should not
happen too often so it doesn't need to be super fast, I think proper
reformatting should take priority.

-Eric

On Thu, May 27, 2010 at 03:02:54AM +0530, Ashish wrote:
>    As part of my gsoc project, I've been doing developments on the curses
>    based UI for boots. My work is available in the branchA 
>    lp:~ashishsharma/boots/cui-main .
> 
>    In this part I am now working out the way in which I should handle the
>    buffer in terminal. In which way should I keep the buffer contents so that
>    scrolling through it is efficient. I was recently looking at the
>    gnome-terminal to see how it handles its buffer.
>    I did the following experiment, I opened a small terminal window, did ls
>    sometimes. After that I maximized it. Then I did ls some moreA  times and
>    then un-maximized it. shot1.png is of maximized window and shot2.png is of
>    un-maximized window. I found that the gnome-terminal maintains a buffer of
>    fixed-size line .
> 
>    So in curses UI also I'm planning to create a buffer that will store
>    fixed-size lines. On terminal resize the contents of the buffer already
>    create shall not be changed according to new line size of terminal. The
>    display will show contents of buffer lines that can be shown (i.e, suppose
>    you currently have 80 char long lines, ls prints in two lines. Now when a
>    resize occurs and line size becomes 160 char, then this previous ls output
>    will not be formatted again.).
> 
>    Comments and feedback on this understanding of mine how terminal works
>    will be highly appreciated.
> 
>    Best regards,
>    Ashish Sharma (_buck)
>    http://www.google.com/profiles/eraser029



> _______________________________________________
> Mailing list: https://launchpad.net/~boots-developers
> Post to     : boots-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~boots-developers
> More help   : https://help.launchpad.net/ListHelp




Follow ups

References