From 989a854e3d5e110be8fe4cf650612623ad70866c Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Thu, 20 Jun 2002 19:25:56 +0000 Subject: Add a -s option to enable the smooth scrolling in revision 1.10 The default behavior remains unchanged. --- usr.bin/talk/display.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'usr.bin/talk/display.c') diff --git a/usr.bin/talk/display.c b/usr.bin/talk/display.c index e25aa6c6b2c..24260ea4449 100644 --- a/usr.bin/talk/display.c +++ b/usr.bin/talk/display.c @@ -1,4 +1,4 @@ -/* $OpenBSD: display.c,v 1.11 2002/06/20 10:18:29 form Exp $ */ +/* $OpenBSD: display.c,v 1.12 2002/06/20 19:25:55 millert Exp $ */ /* $NetBSD: display.c,v 1.3 1994/12/09 02:14:13 jtc Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)display.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: display.c,v 1.11 2002/06/20 10:18:29 form Exp $"; +static char rcsid[] = "$OpenBSD: display.c,v 1.12 2002/06/20 19:25:55 millert Exp $"; #endif /* not lint */ /* @@ -54,6 +54,7 @@ WINDOW *line_win; int curses_initialized = 0; int high_print = 0; +bool smooth_scroll = FALSE; /* * max HAS to be a function, it is called with @@ -200,11 +201,19 @@ xscroll(win, flag) win->x_col = 0; return; } - win->x_line = (win->x_line + 1) % win->x_nlines; win->x_col = 0; - wmove(win->x_win, win->x_line, win->x_col); - wclrtoeol(win->x_win); - wmove(win->x_win, (win->x_line + 1) % win->x_nlines, win->x_col); - wclrtoeol(win->x_win); + if (smooth_scroll) { + if (++win->x_line == win->x_nlines) { + --win->x_line; + scroll(win->x_win); + } + } else { + win->x_line = (win->x_line + 1) % win->x_nlines; + wmove(win->x_win, win->x_line, win->x_col); + wclrtoeol(win->x_win); + wmove(win->x_win, (win->x_line + 1) % win->x_nlines, + win->x_col); + wclrtoeol(win->x_win); + } wmove(win->x_win, win->x_line, win->x_col); } -- cgit v1.2.3