Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libcurses Add a missing __restore_termios() in an error ...



details:   https://anonhg.NetBSD.org/src/rev/3647b863db92
branches:  trunk
changeset: 484965:3647b863db92
user:      jdc <jdc%NetBSD.org@localhost>
date:      Sat Apr 15 22:59:05 2000 +0000

description:
Add a missing __restore_termios() in an error return.
Don't display the character on curscr if the terminal has echo on :
  - doing so will break the tracking of curscr->cury|x if we've just refreshed
  a non-fullscreen window
  - with echo on, the terminal displays the character for us anyway

diffstat:

 lib/libcurses/getch.c |  15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diffs (52 lines):

diff -r 87a3e6262254 -r 3647b863db92 lib/libcurses/getch.c
--- a/lib/libcurses/getch.c     Sat Apr 15 22:53:46 2000 +0000
+++ b/lib/libcurses/getch.c     Sat Apr 15 22:59:05 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getch.c,v 1.18 2000/04/15 13:17:03 blymn Exp $ */
+/*     $NetBSD: getch.c,v 1.19 2000/04/15 22:59:05 jdc 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.18 2000/04/15 13:17:03 blymn Exp $");
+__RCSID("$NetBSD: getch.c,v 1.19 2000/04/15 22:59:05 jdc Exp $");
 #endif
 #endif                                 /* not lint */
 
@@ -494,8 +494,8 @@
            && __echoit)
                return (ERR);
 #ifdef DEBUG
-       __CTRACE("wgetch: __echoit = %d, __rawmode = %d\n",
-           __echoit, __rawmode);
+       __CTRACE("wgetch: __echoit = %d, __rawmode = %d, flags = %0.2o\n",
+           __echoit, __rawmode, win->flags);
 #endif
        if (__echoit && !__rawmode) {
                cbreak();
@@ -512,7 +512,10 @@
                        inp = inkey (win->flags & __NOTIMEOUT ? 0 : 1, 0);
                        break;
                case 0:
-                       if (__nodelay() == ERR) return ERR;
+                       if (__nodelay() == ERR) {
+                               __restore_termios();
+                               return ERR;
+                       }
                        inp = inkey(0, 0);
                        break;
                default:
@@ -567,8 +570,10 @@
 
        __restore_termios();
        if (__echoit) {
+/*
                mvwaddch(curscr,
                    (int) (win->cury + win->begy), (int) (win->curx + win->begx), (chtype) inp);
+*/
                waddch(win, (chtype) inp);
        }
        if (weset)



Home | Main Index | Thread Index | Old Index