From 2512c12cefedc84c9feb895f5b4bab0a3d616620 Mon Sep 17 00:00:00 2001 From: deuce <> Date: Wed, 24 Mar 2004 02:47:33 +0000 Subject: [PATCH] Use curses.h instead of ncurses.h When _putch() is called to display a space, use a BOLD space. Don't ask me why, but this fixes an issue with every curses other than ncurses (growl) Remove use if SP macro in uifc32.c (It's just silly.) --- src/uifc/ciowrap.c | 18 +++++++++++------- src/uifc/ciowrap.h | 2 +- src/uifc/curs_fix.h | 2 +- src/uifc/uifc32.c | 18 +++++++++--------- 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/uifc/ciowrap.c b/src/uifc/ciowrap.c index 07570bd007..bc2d9fbf05 100644 --- a/src/uifc/ciowrap.c +++ b/src/uifc/ciowrap.c @@ -307,8 +307,8 @@ int cio_gettext(int sx, int sy, int ex, int ey, unsigned char *fill) void textattr(unsigned char attr) { - int attrs=A_NORMAL; - short colour; + chtype attrs=A_NORMAL; + int colour; if (lastattr==attr) return; @@ -327,6 +327,7 @@ void textattr(unsigned char attr) #ifdef NCURSES_VERSION_MAJOR color_set(colour,NULL); #endif + /* bkgdset(colour); */ bkgdset(colour); } @@ -366,7 +367,7 @@ int wherex(void) void _putch(unsigned char ch, BOOL refresh_now) { - int cha; + chtype cha; if(!(mode&UIFC_IBM)) { @@ -527,9 +528,11 @@ void _putch(unsigned char ch, BOOL refresh_now) cha=ch; } } - - addch(cha); + if(ch == ' ') + addch(A_BOLD|' '); + else + addch(cha); if(refresh_now) refresh(); } @@ -537,7 +540,7 @@ void _putch(unsigned char ch, BOOL refresh_now) int cprintf(char *fmat, ...) { va_list argptr; - char str[MAX_BFLN]; + unsigned char str[MAX_BFLN]; int pos; va_start(argptr,fmat); @@ -551,7 +554,7 @@ int cprintf(char *fmat, ...) return(1); } -void cputs(char *str) +void cputs(unsigned char *str) { int pos; @@ -585,6 +588,7 @@ void initciowrap(long inmode) nonl(); keypad(stdscr, TRUE); scrollok(stdscr,FALSE); + idcok(stdscr,FALSE); raw(); /* Set up color pairs */ diff --git a/src/uifc/ciowrap.h b/src/uifc/ciowrap.h index 10e7cf8055..10685f86fb 100644 --- a/src/uifc/ciowrap.h +++ b/src/uifc/ciowrap.h @@ -61,7 +61,7 @@ int wherey(void); int wherex(void); void _putch(unsigned char ch, BOOL refresh_now); int cprintf(char *fmat, ...); -void cputs(char *str); +void cputs(unsigned char *str); void gotoxy(int x, int y); void clrscr(void); void initciowrap(long inmode); diff --git a/src/uifc/curs_fix.h b/src/uifc/curs_fix.h index 90ed53c465..ac25b9c441 100644 --- a/src/uifc/curs_fix.h +++ b/src/uifc/curs_fix.h @@ -1,6 +1,6 @@ /* $Id$ */ -#include <ncurses.h> +#include <curses.h> #ifndef ACS_SBSD #define ACS_SBSD ACS_SBSS diff --git a/src/uifc/uifc32.c b/src/uifc/uifc32.c index 765a583c13..114e96cf4e 100644 --- a/src/uifc/uifc32.c +++ b/src/uifc/uifc32.c @@ -347,7 +347,7 @@ static void truncsp(char *str) uint c; c=strlen(str); - while(c && (uchar)str[c-1]<=SP) c--; + while(c && (uchar)str[c-1]<=' ') c--; if(str[c]!=0) /* don't write to string constants */ str[c]=0; } @@ -1178,7 +1178,7 @@ int uinput(int mode, int left, int top, char *prompt, char *str, in_win[i++]=hclr|(bclr<<4); if(plen) { - in_win[i++]=SP; + in_win[i++]=' '; in_win[i++]=lclr|(bclr<<4); } @@ -1193,7 +1193,7 @@ int uinput(int mode, int left, int top, char *prompt, char *str, } for(c=0;c<max+2;c++) { - in_win[i++]=SP; + in_win[i++]=' '; in_win[i++]=lclr|(bclr<<4); } @@ -1370,7 +1370,7 @@ int ugetstr(int left, int top, char *outstr, int max, long mode, int *lastkey) gettext(wherex(),y,wherex()+(j-i),y,buf); puttext(wherex()-1,y,wherex()+(j-i)-1,y,buf); gotoxy(wherex()+(j-i),y); - putch(SP); + putch(' '); gotoxy(wherex()-((j-i)+2),y); i--; j--; @@ -1387,7 +1387,7 @@ int ugetstr(int left, int top, char *outstr, int max, long mode, int *lastkey) gettext(wherex()+1,y,wherex()+(j-i),y,buf); puttext(wherex(),y,wherex()+(j-i)-1,y,buf); gotoxy(wherex()+(j-i),y); - putch(SP); + putch(' '); gotoxy(wherex()-((j-i)+1),y); for(k=i;k<j;k++) str[k]=str[k+1]; @@ -1446,7 +1446,7 @@ int ugetstr(int left, int top, char *outstr, int max, long mode, int *lastkey) } if(mode&K_ALPHA && !isalpha(ch)) continue; - if((ch>=SP || (ch==1 && mode&K_MSG)) && i<max && (!ins || j<max) && isprint(ch)) + if((ch>=' ' || (ch==1 && mode&K_MSG)) && i<max && (!ins || j<max) && isprint(ch)) { if(mode&K_UPPER) ch=toupper(ch); @@ -1656,7 +1656,7 @@ void upop(char *str) /* gettext(28,12,53,14,sav); */ gettext((api->scrn_width-26+1)/2+1,(api->scrn_len-3+1)/2+1 ,(api->scrn_width+26-1)/2+1,(api->scrn_len+3-1)/2+1,sav); - memset(buf,SP,25*3*2); + memset(buf,' ',25*3*2); for(i=1;i<26*3*2;i+=2) buf[i]=(hclr|(bclr<<4)); buf[0]='�'; @@ -1746,7 +1746,7 @@ void showbuf(int mode, int left, int top, int width, int height, char *title, ch gettext(1,1,api->scrn_width,api->scrn_len,tmp_buffer); if(!is_redraw) { - memset(tmp_buffer2,SP,width*height*2); + memset(tmp_buffer2,' ',width*height*2); for(i=1;i<width*height*2;i+=2) tmp_buffer2[i]=(hclr|(bclr<<4)); tmp_buffer2[0]='�'; @@ -1830,7 +1830,7 @@ void showbuf(int mode, int left, int top, int width, int height, char *title, ch _setcursortype(cursor); return; } - memset(textbuf,SP,(width-2-pad-pad)*lines*2); + memset(textbuf,' ',(width-2-pad-pad)*lines*2); for(i=1;i<(width-2-pad-pad)*lines*2;i+=2) textbuf[i]=(hclr|(bclr<<4)); i=0; -- GitLab