Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-6]: src/lib/libcurses Apply patch (requested by jdc in ticket #...
details: https://anonhg.NetBSD.org/src/rev/b5871dfca86c
branches: netbsd-1-6
changeset: 530283:b5871dfca86c
user: grant <grant%NetBSD.org@localhost>
date: Mon Jun 16 13:14:20 2003 +0000
description:
Apply patch (requested by jdc in ticket #1244):
Keep the cr->nl translation state in a separate variable, so that we can
do the translation ourselves (if the tty didn't do it for us).
Add debugging to track functions that change tty state.
diffstat:
lib/libcurses/curses_private.h | 3 ++-
lib/libcurses/getch.c | 11 +++++++----
lib/libcurses/screen.c | 6 +++---
lib/libcurses/tty.c | 30 ++++++++++++++++++++++++++++--
4 files changed, 40 insertions(+), 10 deletions(-)
diffs (197 lines):
diff -r e16288774b80 -r b5871dfca86c lib/libcurses/curses_private.h
--- a/lib/libcurses/curses_private.h Mon Jun 16 13:05:39 2003 +0000
+++ b/lib/libcurses/curses_private.h Mon Jun 16 13:14:20 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: curses_private.h,v 1.20 2002/01/02 10:38:27 blymn Exp $ */
+/* $NetBSD: curses_private.h,v 1.20.2.1 2003/06/16 13:14:20 grant Exp $ */
/*-
* Copyright (c) 1998-2000 Brett Lymn
@@ -219,6 +219,7 @@
int echoit;
int pfast;
int rawmode;
+ int nl;
int noqch;
int clearok;
int useraw;
diff -r e16288774b80 -r b5871dfca86c lib/libcurses/getch.c
--- a/lib/libcurses/getch.c Mon Jun 16 13:05:39 2003 +0000
+++ b/lib/libcurses/getch.c Mon Jun 16 13:14:20 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: getch.c,v 1.36 2002/01/02 10:38:27 blymn Exp $ */
+/* $NetBSD: getch.c,v 1.36.2.1 2003/06/16 13:14:31 grant Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)getch.c 8.2 (Berkeley) 5/4/94";
#else
-__RCSID("$NetBSD: getch.c,v 1.36 2002/01/02 10:38:27 blymn Exp $");
+__RCSID("$NetBSD: getch.c,v 1.36.2.1 2003/06/16 13:14:31 grant Exp $");
#endif
#endif /* not lint */
@@ -708,8 +708,8 @@
if (is_wintouched(win))
wrefresh(win);
#ifdef DEBUG
- __CTRACE("wgetch: __echoit = %d, __rawmode = %d, flags = %0.2o\n",
- __echoit, __rawmode, win->flags);
+ __CTRACE("wgetch: __echoit = %d, __nl = %d, __rawmode = %d, flags = %0.2o\n",
+ __echoit, _cursesi_screen->nl, __rawmode, win->flags);
#endif
if (__echoit && !__rawmode) {
cbreak();
@@ -794,6 +794,9 @@
if (weset)
nocbreak();
+ if (_cursesi_screen->nl && inp == 13)
+ inp = 10;
+
return ((inp < 0) || (inp == ERR) ? ERR : inp);
}
diff -r e16288774b80 -r b5871dfca86c lib/libcurses/screen.c
--- a/lib/libcurses/screen.c Mon Jun 16 13:05:39 2003 +0000
+++ b/lib/libcurses/screen.c Mon Jun 16 13:14:20 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: screen.c,v 1.5 2002/01/02 10:38:29 blymn Exp $ */
+/* $NetBSD: screen.c,v 1.5.2.1 2003/06/16 13:14:41 grant Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)screen.c 8.2 (blymn) 11/27/2001";
#else
-__RCSID("$NetBSD: screen.c,v 1.5 2002/01/02 10:38:29 blymn Exp $");
+__RCSID("$NetBSD: screen.c,v 1.5.2.1 2003/06/16 13:14:41 grant Exp $");
#endif
#endif /* not lint */
@@ -127,7 +127,7 @@
new_screen->infd = infd;
new_screen->outfd = outfd;
- new_screen->echoit = 1;
+ new_screen->echoit = new_screen->nl = 1;
new_screen->pfast = new_screen->rawmode = new_screen->noqch = 0;
new_screen->nca = A_NORMAL;
new_screen->color_type = COLOR_NONE;
diff -r e16288774b80 -r b5871dfca86c lib/libcurses/tty.c
--- a/lib/libcurses/tty.c Mon Jun 16 13:05:39 2003 +0000
+++ b/lib/libcurses/tty.c Mon Jun 16 13:14:20 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tty.c,v 1.28 2002/01/02 10:38:29 blymn Exp $ */
+/* $NetBSD: tty.c,v 1.28.2.1 2003/06/16 13:14:50 grant Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)tty.c 8.6 (Berkeley) 1/10/95";
#else
-__RCSID("$NetBSD: tty.c,v 1.28 2002/01/02 10:38:29 blymn Exp $");
+__RCSID("$NetBSD: tty.c,v 1.28.2.1 2003/06/16 13:14:50 grant Exp $");
#endif
#endif /* not lint */
@@ -158,6 +158,9 @@
int
raw(void)
{
+#ifdef DEBUG
+ __CTRACE("raw()\n");
+#endif
/* Check if we need to restart ... */
if (_cursesi_screen->endwin)
__restartwin();
@@ -172,6 +175,9 @@
int
noraw(void)
{
+#ifdef DEBUG
+ __CTRACE("noraw()\n");
+#endif
/* Check if we need to restart ... */
if (_cursesi_screen->endwin)
__restartwin();
@@ -186,6 +192,9 @@
int
cbreak(void)
{
+#ifdef DEBUG
+ __CTRACE("cbreak()\n");
+#endif
/* Check if we need to restart ... */
if (_cursesi_screen->endwin)
__restartwin();
@@ -201,6 +210,9 @@
int
nocbreak(void)
{
+#ifdef DEBUG
+ __CTRACE("nocbreak()\n");
+#endif
/* Check if we need to restart ... */
if (_cursesi_screen->endwin)
__restartwin();
@@ -318,6 +330,9 @@
int
echo(void)
{
+#ifdef DEBUG
+ __CTRACE("echo()\n");
+#endif
/* Check if we need to restart ... */
if (_cursesi_screen->endwin)
__restartwin();
@@ -329,6 +344,9 @@
int
noecho(void)
{
+#ifdef DEBUG
+ __CTRACE("noecho()\n");
+#endif
/* Check if we need to restart ... */
if (_cursesi_screen->endwin)
__restartwin();
@@ -340,6 +358,9 @@
int
nl(void)
{
+#ifdef DEBUG
+ __CTRACE("nl()\n");
+#endif
/* Check if we need to restart ... */
if (_cursesi_screen->endwin)
__restartwin();
@@ -351,6 +372,7 @@
_cursesi_screen->baset.c_iflag |= ICRNL;
_cursesi_screen->baset.c_oflag |= ONLCR;
+ _cursesi_screen->nl = 1;
_cursesi_screen->pfast = _cursesi_screen->rawmode;
return (tcsetattr(fileno(_cursesi_screen->infd), __tcaction ?
TCSASOFT | TCSADRAIN : TCSADRAIN,
@@ -360,6 +382,9 @@
int
nonl(void)
{
+#ifdef DEBUG
+ __CTRACE("nonl()\n");
+#endif
/* Check if we need to restart ... */
if (_cursesi_screen->endwin)
__restartwin();
@@ -371,6 +396,7 @@
_cursesi_screen->baset.c_iflag &= ~ICRNL;
_cursesi_screen->baset.c_oflag &= ~ONLCR;
+ _cursesi_screen->nl = 0;
__pfast = 1;
return (tcsetattr(fileno(_cursesi_screen->infd), __tcaction ?
TCSASOFT | TCSADRAIN : TCSADRAIN,
Home |
Main Index |
Thread Index |
Old Index