mudgangster

Log | Files | Refs

commit ef4a98aba49c5feb9099df8eb41a424440769d66
parent bec17acc262bd724ec8bea00ecbf0abefb07d008
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Fri,  7 Sep 2018 21:50:43 +0300

Fix scroll sliding when scrollback buffer is full

Diffstat:
src/textbox.cc | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/textbox.cc b/src/textbox.cc @@ -53,6 +53,8 @@ void textbox_add( TextBox * tb, const char * str, size_t len, Colour fg, Colour } void textbox_newline( TextBox * tb ) { + tb->dirty = true; + if( tb->num_lines < tb->max_lines ) { tb->num_lines++; if( tb->scroll_offset > 0 ) @@ -61,10 +63,10 @@ void textbox_newline( TextBox * tb ) { } tb->head++; + tb->scroll_offset = min( tb->scroll_offset + 1, tb->num_lines - 1 ); + TextBox::Line * line = &tb->lines[ ( tb->head + tb->num_lines ) % tb->max_lines ]; line->len = 0; - - tb->dirty = true; } void textbox_scroll( TextBox * tb, int offset ) {