Commit 51dfb78f authored by deuce's avatar deuce
Browse files

Tab handling fixes... for conio, extend tab set past 80 columns to over

132 to support all modes and do proper wrapping.
For cterm, remove extra tab handling code, start tab sequence with 1,9
and other general tab fixes.

This seems to bring it into line with UNIX consoles and HyperTerminal.
parent 3f1292d5
......@@ -68,7 +68,7 @@
CIOLIBEXPORT cioapi_t cio_api;
static const int tabs[10]={9,17,25,33,41,49,57,65,73,80};
static const int tabs[]={1,9,17,25,33,41,49,57,65,73,81,89,97,105,113,121,129,137,145};
static int ungotch;
struct text_info cio_textinfo;
static int lastmode=3;
......@@ -1097,7 +1097,7 @@ CIOLIBEXPORT int CIOLIBCALL ciolib_putch(int a)
ciolib_beep();
break;
case '\t':
for(i=0;i<10;i++) {
for(i=0;i<(sizeof(tabs)/sizeof(int));i++) {
if(tabs[i]>cio_textinfo.curx) {
buf[0]=' ';
while(cio_textinfo.curx<tabs[i]) {
......@@ -1107,11 +1107,13 @@ CIOLIBEXPORT int CIOLIBCALL ciolib_putch(int a)
,cio_textinfo.cury+cio_textinfo.wintop-1
,buf);
ciolib_gotoxy(cio_textinfo.curx+1,cio_textinfo.cury);
if(cio_textinfo.curx==cio_textinfo.screenwidth)
break;
}
break;
}
}
if(i==10) {
if(cio_textinfo.curx==cio_textinfo.screenwidth) {
ciolib_gotoxy(1,cio_textinfo.cury);
if(cio_textinfo.cury==cio_textinfo.winbottom-cio_textinfo.wintop+1)
ciolib_wscroll();
......
......@@ -63,7 +63,7 @@
struct cterminal cterm;
const int cterm_tabs[]={8,16,24,32,40,48,56,64,72,80,88,96,104,112,120,128,132,136};
const int cterm_tabs[]={1,9,17,25,33,41,49,57,65,73,81,89,97,105,113,121,129,137,145};
const char *octave="C#D#EF#G#A#B";
......@@ -1293,26 +1293,23 @@ void ctputs(char *buf)
case 7: /* Bell */
break;
case '\t':
*p=0;
cputs(outp);
outp=p+1;
for(i=0;i<sizeof(cterm_tabs)/sizeof(cterm_tabs[0]);i++) {
if(cterm_tabs[i]>cx) {
while(cx<cterm_tabs[i]) {
cx++;
}
cx=cterm_tabs[i];
break;
}
}
if(cx>cterm.width) {
cx=1;
if(cy==cterm.height) {
*p=0;
cputs(outp);
outp=p+1;
if(cy==cterm.height)
scrollup();
gotoxy(cx,cy);
}
else
cy++;
}
gotoxy(cx,cy);
break;
default:
if(cy==cterm.height
......@@ -2012,18 +2009,6 @@ char *cterm_write(unsigned char *buf, int buflen, char *retbuf, size_t retsize,
prn[0]=0;
cterm.sequence=1;
break;
case '\t':
ctputs(prn);
prn[0]=0;
if(cterm.log==CTERM_LOG_ASCII && cterm.logfile != NULL)
fputs("\t", cterm.logfile);
for(k=0;k<sizeof(cterm_tabs)/sizeof(cterm_tabs[0]);k++) {
if(cterm_tabs[k]>wherex()) {
gotoxy(cterm_tabs[k],wherey());
break;
}
}
break;
default:
strcat(prn,ch);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment