[haiku-commits] haiku: hrev53147 - src/apps/serialconnect

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 19 May 2019 10:00:51 -0400 (EDT)

hrev53147 adds 1 changeset to branch 'master'
old head: 1eb386084c57314c05607ca80c048f0c6fdc3b80
new head: d4b3a3277dc3bc7630f94194b94f6909280c27e6
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=d4b3a3277dc3+%5E1eb386084c57

----------------------------------------------------------------------------

d4b3a3277dc3: SerialConnect: implement PopLine to get items from scrollback
  
  Allows to make the scrollback visible again when resizing, instead of
  adding blank lines at the bottom.
  
  Change-Id: I7a14188cdcb14bcd197325b935d8cfe2435ae80f
  Reviewed-on: https://review.haiku-os.org/c/1464
  Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

                             [ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev53147
Commit:      d4b3a3277dc3bc7630f94194b94f6909280c27e6
URL:         https://git.haiku-os.org/haiku/commit/?id=d4b3a3277dc3
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Sun May 19 10:03:35 2019 UTC
Committer:   waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Sun May 19 14:00:48 2019 UTC

----------------------------------------------------------------------------

1 file changed, 15 insertions(+), 2 deletions(-)
src/apps/serialconnect/TermView.cpp | 17 +++++++++++++++--

----------------------------------------------------------------------------

diff --git a/src/apps/serialconnect/TermView.cpp 
b/src/apps/serialconnect/TermView.cpp
index 072830301b..0ae4fecb8b 100644
--- a/src/apps/serialconnect/TermView.cpp
+++ b/src/apps/serialconnect/TermView.cpp
@@ -449,6 +449,7 @@ TermView::_PushLine(int cols, const VTermScreenCell* cells)
 
        fScrollBuffer.AddItem(item, 0);
 
+       // Remove extra items if the scrollback gets too long
        free(fScrollBuffer.RemoveItem(kScrollBackSize));
 
        _UpdateScrollbar();
@@ -486,8 +487,20 @@ TermView::_UpdateScrollbar()
 int
 TermView::_PopLine(int cols, VTermScreenCell* cells)
 {
-       /* TODO can be used when switching to alt screen and when resizing */
-       return 0;
+       ScrollBufferItem* item = 
(ScrollBufferItem*)fScrollBuffer.RemoveItem(0l);
+       if (item == NULL)
+               return 0;
+
+       _UpdateScrollbar();
+       if (item->cols >= cols) {
+               memcpy(cells, item->cells, cols * sizeof(VTermScreenCell));
+       } else {
+               memcpy(cells, item->cells, item->cols * 
sizeof(VTermScreenCell));
+               for (int i = item->cols; i < cols; i++)
+                       cells[i] = cells[i - 1];
+       }
+       free(item);
+       return 1;
 }
 
 


Other related posts:

  • » [haiku-commits] haiku: hrev53147 - src/apps/serialconnect - waddlesplash