dvtm

dynamic virtual terminal manager - with my changes
git clone https://pi.duncano.de/git/dvtm.git
Log | Files | Refs | README | LICENSE

commit 3f07e5460b92513c9fd509113f5b6d1be6250bba
parent e611cbe6db4ed9d4b9b59295857d535a049d8f5f
Author: Marc Andre Tanner <mat@brain-dump.org>
Date:   Sat, 30 Aug 2008 10:08:32 +0200

Specify scrollback buffer size on terminal creation

Diffstat:
dvtm.c | 2+-
madtty.c | 6++++--
madtty.h | 2+-
3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/dvtm.c b/dvtm.c @@ -621,7 +621,7 @@ create(const char *args[]) { const char *env[] = NULL; #endif c->window = newwin(wah, waw, way, wax); - c->term = madtty_create(height - 1, width); + c->term = madtty_create(height - 1, width, 500); c->cmd = cmd; if (args && args[1]) strncpy(c->title, args[1], sizeof(c->title)); diff --git a/madtty.c b/madtty.c @@ -926,7 +926,7 @@ int madtty_process(madtty_t *t) return 0; } -madtty_t *madtty_create(int rows, int cols) +madtty_t *madtty_create(int rows, int cols, int scroll_buf_sz) { madtty_t *t; int i; @@ -964,7 +964,9 @@ madtty_t *madtty_create(int rows, int cols) t->scroll_bot = t->lines + t->rows; /* scrollback buffer */ - t->scroll_buf_sz = 1000; + if (scroll_buf_sz < 0) + scroll_buf_sz = 0; + t->scroll_buf_sz = scroll_buf_sz; t->scroll_buf = calloc(sizeof(t_row_t), t->scroll_buf_sz); for (i = 0; i < t->scroll_buf_sz; i++) { t->scroll_buf[i].text = calloc(sizeof(wchar_t), t->cols); diff --git a/madtty.h b/madtty.h @@ -59,7 +59,7 @@ void madtty_set_data(madtty_t *, void *); void *madtty_get_data(madtty_t *); int madtty_color_pair(int fg, int bg); -madtty_t *madtty_create(int rows, int cols); +madtty_t *madtty_create(int rows, int cols, int scroll_buf_sz); void madtty_resize(madtty_t *, int rows, int cols); void madtty_destroy(madtty_t *); pid_t madtty_forkpty(madtty_t *, const char *, const char *argv[], const char *envp[], int *pty);