summaryrefslogtreecommitdiff
path: root/lib/libcurses/addbytes.c
diff options
context:
space:
mode:
authoralm <alm@NetBSD.org>1993-07-09 05:34:14 +0000
committeralm <alm@NetBSD.org>1993-07-09 05:34:14 +0000
commit75de25bb937aed7d7fbdbd3a822fbc03d8bf6a08 (patch)
treea8a314f717e88a1f7fb1700d111d7263e416f95a /lib/libcurses/addbytes.c
parentcb880ccb9480246e8ba2026db43f12f1f2e8dde8 (diff)
added Andrew Chernov's patch set:
Standard curses library use eight bit for standout mode, so 8-bit characters displays like highlighted 7-bit characters. This patch produce library which is fully compatible with all curses programs and add 8-bit chars to all input/display functions. --- I don't think, that any programs wish to use internal curses attribute _STANDOUT directly, in expressions like: addch( ch | _STANDOUT ); Normal interface use standout() and standend() functions instead. Many programs use 'char' type (with sign extention) for input characters and sign extention becomes _STANDOUT mode in this case. So, I refuse this future and allow 8-bit characters for programs, which is designed for 7-bit only ('char' type using instead of 'unsigned char'). --- This small patch fix unpleasant standard curses bug: curses can't expand TAB at all (but tries). A man who wrote this curses misplace SYNC_IN and SYNCH_OUT, this patch exchange macro calls. This patch useful for standard 7-bit curses too, for this you must delete '_' symbol before waddbytes and apply patch. --- Oh, NO! This curses are really buggy! This small patch fix following problem: [ assumed scrollok(stdscr, TRUE) ] when addch(ch) at lower right corner of screen, curses are realy gone mad instead if simple scrolling... Curses code assumed that this will be done correctly, but implement it with two bugs.
Diffstat (limited to 'lib/libcurses/addbytes.c')
-rw-r--r--lib/libcurses/addbytes.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/lib/libcurses/addbytes.c b/lib/libcurses/addbytes.c
index 0ddc5f084cb..3d47b326acf 100644
--- a/lib/libcurses/addbytes.c
+++ b/lib/libcurses/addbytes.c
@@ -37,13 +37,29 @@ static char sccsid[] = "@(#)addbytes.c 5.4 (Berkeley) 6/1/90";
# include "curses.ext"
+waddbytes(win, bytes, count)
+reg WINDOW *win;
+reg char *bytes;
+int count;
+{
+ chtype c;
+ reg int i;
+
+ for (i = 0; i < count; i++) {
+ c = (unsigned char) *bytes++;
+ if (_waddbytes(win, &c, 1) == ERR)
+ return ERR;
+ }
+ return OK;
+}
+
/*
* This routine adds the character to the current position
*
*/
-waddbytes(win, bytes, count)
+_waddbytes(win, bytes, count)
reg WINDOW *win;
-reg char *bytes;
+reg chtype *bytes;
reg int count;
{
#define SYNCH_OUT() {win->_cury = y; win->_curx = x;}
@@ -52,18 +68,15 @@ reg int count;
reg int newx;
SYNCH_IN();
-# ifdef FULLDEBUG
- fprintf(outf, "ADDBYTES('%c') at (%d, %d)\n", c, y, x);
-# endif
while (count--) {
- register int c;
- static char blanks[] = " ";
+ register chtype c;
+ static chtype blanks[] = {' ',' ',' ',' ',' ',' ',' ',' '};
c = *bytes++;
switch (c) {
case '\t':
SYNCH_OUT();
- if (waddbytes(win, blanks, 8-(x%8)) == ERR) {
+ if (_waddbytes(win, blanks, 8-(x%8)) == ERR) {
return ERR;
}
SYNCH_IN();
@@ -102,10 +115,10 @@ reg int count;
newline:
if (++y >= win->_maxy)
if (win->_scroll) {
+ --y;
SYNCH_OUT();
scroll(win);
SYNCH_IN();
- --y;
}
else
return ERR;