boots-developers team mailing list archive
-
boots-developers team
-
Mailing list archive
-
Message #00010
Re: Understanding terminal's buffer handling
Hi Eric,
Thanks for the reply. At first, I was buffering only the raw data.
But then it occurred to me that it would take a lot of computation to
regenerate lines out of it again and again. So, then I thought of the other
way of creating lines of the width same as that of terminal, when they were
created. I am the using latter approach right now.
Current it works as follows,
1. If terminal width is reduced, then the part of line that cannot be
displayed is trimmed off and only the part that fits in terminal width is
displayed.
2. If terminal width is increased, then the previously built lines are used
as they are.
Both the cases, (decrease and increase in width of terminal) are dealt with
easily this way. I'll continue with this approach if you find it right.
Best regards,
Ashish Sharma
http://www.google.com/profiles/eraser029
On Thu, Jun 3, 2010 at 3:27 AM, Eric Day <eday@xxxxxxxxxxxx> wrote:
> 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<https://launchpad.net/%7Eboots-developers>
> > Post to : boots-developers@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~boots-developers<https://launchpad.net/%7Eboots-developers>
> > More help : https://help.launchpad.net/ListHelp
>
>
Follow ups
References