diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2002-06-20 19:25:56 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2002-06-20 19:25:56 +0000 |
commit | 989a854e3d5e110be8fe4cf650612623ad70866c (patch) | |
tree | 2168226b48182375302f09d5df1041ec09f5ac49 | |
parent | cc8eab5909db16ffed30953fb1bad6dbd5a41ef9 (diff) |
Add a -s option to enable the smooth scrolling in revision 1.10
The default behavior remains unchanged.
-rw-r--r-- | usr.bin/talk/display.c | 23 | ||||
-rw-r--r-- | usr.bin/talk/get_names.c | 15 | ||||
-rw-r--r-- | usr.bin/talk/init_disp.c | 8 | ||||
-rw-r--r-- | usr.bin/talk/talk.1 | 20 | ||||
-rw-r--r-- | usr.bin/talk/talk.h | 4 |
5 files changed, 46 insertions, 24 deletions
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); } diff --git a/usr.bin/talk/get_names.c b/usr.bin/talk/get_names.c index 63e9e6c335a..bce79d964d4 100644 --- a/usr.bin/talk/get_names.c +++ b/usr.bin/talk/get_names.c @@ -1,4 +1,4 @@ -/* $OpenBSD: get_names.c,v 1.9 2001/11/19 19:02:16 mpech Exp $ */ +/* $OpenBSD: get_names.c,v 1.10 2002/06/20 19:25:55 millert Exp $ */ /* $NetBSD: get_names.c,v 1.4 1994/12/09 02:14:16 jtc Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)get_names.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: get_names.c,v 1.9 2001/11/19 19:02:16 mpech Exp $"; +static char rcsid[] = "$OpenBSD: get_names.c,v 1.10 2002/06/20 19:25:55 millert Exp $"; #endif /* not lint */ #include "talk.h" @@ -70,9 +70,16 @@ get_names(argc, argv) high_print = 1; } + if (argc > 1 && !strcmp(argv[1], "-s")) { + argv[1] = argv[0]; + ++argv; + --argc; + smooth_scroll = TRUE; + } + if ((argc < 2 ) || ('@' == argv[1][0])) { - fprintf(stderr, "usage: talk user [ttyname]\n" - " talk user@hostname [ttyname]\n"); + fprintf(stderr, "usage: talk [-Hs] user [ttyname]\n" + " talk [-Hs] user@hostname [ttyname]\n"); exit(1); } if (!isatty(0)) diff --git a/usr.bin/talk/init_disp.c b/usr.bin/talk/init_disp.c index c3f3f16f7ba..5374d4c242a 100644 --- a/usr.bin/talk/init_disp.c +++ b/usr.bin/talk/init_disp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init_disp.c,v 1.13 2002/06/20 10:18:29 form Exp $ */ +/* $OpenBSD: init_disp.c,v 1.14 2002/06/20 19:25:55 millert Exp $ */ /* $NetBSD: init_disp.c,v 1.6 1994/12/09 02:14:17 jtc Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)init_disp.c 8.2 (Berkeley) 2/16/94"; #endif -static char rcsid[] = "$OpenBSD: init_disp.c,v 1.13 2002/06/20 10:18:29 form Exp $"; +static char rcsid[] = "$OpenBSD: init_disp.c,v 1.14 2002/06/20 19:25:55 millert Exp $"; #endif /* not lint */ /* @@ -79,14 +79,14 @@ init_display() my_win.x_nlines = LINES / 2; my_win.x_ncols = COLS; my_win.x_win = newwin(my_win.x_nlines, my_win.x_ncols, 0, 0); - scrollok(my_win.x_win, FALSE); + scrollok(my_win.x_win, smooth_scroll); wclear(my_win.x_win); his_win.x_nlines = LINES / 2 - 1; his_win.x_ncols = COLS; his_win.x_win = newwin(his_win.x_nlines, his_win.x_ncols, my_win.x_nlines+1, 0); - scrollok(his_win.x_win, FALSE); + scrollok(his_win.x_win, smooth_scroll); wclear(his_win.x_win); line_win = newwin(1, COLS, my_win.x_nlines, 0); diff --git a/usr.bin/talk/talk.1 b/usr.bin/talk/talk.1 index 326db6fa8da..d3afe0b1659 100644 --- a/usr.bin/talk/talk.1 +++ b/usr.bin/talk/talk.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: talk.1,v 1.13 2000/12/31 00:24:51 hugh Exp $ +.\" $OpenBSD: talk.1,v 1.14 2002/06/20 19:25:55 millert Exp $ .\" $NetBSD: talk.1,v 1.3 1994/12/09 02:14:23 jtc Exp $ .\" .\" Copyright (c) 1983, 1990, 1993 @@ -42,7 +42,7 @@ .Nd talk to another user .Sh SYNOPSIS .Nm talk -.Op Fl H +.Op Fl Hs .Ar person .Op Ar ttyname .Sh DESCRIPTION @@ -52,6 +52,16 @@ terminal to that of another user. .Pp The command arguments are as follows: .Bl -tag -width ttyname +.It Fl H +Don't escape characters with the high big set. +This may be useful for certain character sets, but could cause erratic +behaviour on some terminals. +.It Fl s +Use smooth scrolling in the +.Nm +window. +The default is to clear the next two rows and jump from the bottom of +the window to the top. .It Ar person If you wish to talk to someone on your own machine, then .Ar person @@ -70,12 +80,6 @@ is of the form .Ql ttyXX . .El .Pp -If the -.Fl H -argument is given, talk will not escape high characters. -This may be useful for certain character sets, but could cause erratic -behaviour on some terminals. -.Pp When first called, .Nm sends the message diff --git a/usr.bin/talk/talk.h b/usr.bin/talk/talk.h index 672b925c710..c3dd045e59c 100644 --- a/usr.bin/talk/talk.h +++ b/usr.bin/talk/talk.h @@ -1,4 +1,4 @@ -/* $OpenBSD: talk.h,v 1.7 2002/02/16 21:27:54 millert Exp $ */ +/* $OpenBSD: talk.h,v 1.8 2002/06/20 19:25:55 millert Exp $ */ /* $NetBSD: talk.h,v 1.3 1994/12/09 02:14:27 jtc Exp $ */ /* @@ -49,6 +49,8 @@ extern int curses_initialized; extern int invitation_waiting; extern int high_print; +extern bool smooth_scroll; + extern char *current_state; extern int current_line; |