Exemple #1
0
int redoinpb(short hand,GRECT box)
{
int xy[4];
char *point;
short junk2;
char temps[2048];
if(hand==-1)return 0;
xy[0]=box.g_x;xy[1]=box.g_y;xy[2]=box.g_x+box.g_w-1;xy[3]=box.g_y+box.g_h-1;
vs_clip(ws.handle,1,xy);
clearwin(box.g_x,box.g_y,box.g_w,box.g_h,col[CINPBACK]);
writeinpinfo(hand);
point=wn[hand].inp+strlen(wn[hand].inp);
vst_font(ws.handle,(WORD)inpfont);
vst_point(ws.handle,(WORD)inppoint,&junk2,&junk2,&junk2,&junk2);
vst_color(ws.handle,col[CINPTEXT]);
point=point-wn[hand].ihc[wn[hand].cvof];
stccpy(temps,point,wn[hand].ihc[wn[hand].cvof]+1);
vswr_mode(ws.handle,MD_TRANS);
v_gtext(ws.handle,wn[hand].wwa.g_x,wn[hand].wwa.g_y+wn[hand].wwa.g_h-1,temps);
if(wn[hand].cvof>0){
point=point-wn[hand].ihc[wn[hand].cvof-1];
stccpy(temps,point,wn[hand].ihc[wn[hand].cvof-1]+1);
v_gtext(ws.handle,wn[hand].wwa.g_x,wn[hand].wwa.g_y+wn[hand].wwa.g_h-ith-1,temps);
}
docursor(hand);
vs_clip(ws.handle,0,NULL);
return 0;
}
Exemple #2
0
/*** mark - <mark> editor function
*
* Purpose:
*
*		       <mark> - Goes to top of file
*		  <arg><mark> - Toggle last/current window position
*	 <arg> textarg <mark> - Goes to named mark
*   <arg><arg> textarg <mark> - Defines mark at cursor
*   <arg><arg> textarg <mark> - Removes named mark
*
* Input:
*
* Output:
*
*   Returns FALSE if you try to go to a non-existent mark, TRUE
*   otherwise.
*
*************************************************************************/
flagType
mark (
    CMDDATA argData,
    ARG *pArg,
    flagType fMeta
    ) {

    buffer mbuf;

    switch (pArg->argType) {

    case NOARG:
        docursor (0, (LINE)0);
        return TRUE;

    case TEXTARG:
	strcpy ((char *) mbuf, pArg->arg.textarg.pText);
        if (fIsNum (mbuf)) {
            docursor (0, atol (mbuf)-1);
            return TRUE;
        }
        if (pArg->arg.textarg.cArg == 2) {
            if (fMeta) {
                DeleteMark (mbuf);
            } else {
                DefineMark (mbuf, pFileHead, pArg->arg.textarg.y+1, pArg->arg.textarg.x+1, FALSE);
            }
            return TRUE;
        } else {
            return GoToMark (mbuf);
        }

    case NULLARG:
        restflip();
        return TRUE;

    /*  LINEARG illegal             */
    /*  STREAMARG illegal           */
    /*  BOXARG illegal              */

    }
    argData;
}
Exemple #3
0
char *fgets_cons(char *str, size_t max)
{   
   int c;
   int ptr;
   ptr=0;

   docursor();
   while (ptr < max - 1) {
      c = fgetc_cons();

      if (c == KEY_CAPS_LOCK)
      {
         _cons_state ^= 1; // Toggle caps lock
      }
      else if ( c == KEY_DEL)
      {
	if ( ptr > 0 )
	{
           fgets_cons_erase_character('_');
           fgets_cons_erase_character(str[--ptr]);
           str[ptr] = 0;
           docursor();
        }
      }
      else
      {
         if (_cons_state)
            c = toupper(c);
            
         str[ptr++] = c;
         str[ptr] = 0;
         fgets_cons_erase_character('_');
	 fputc_cons(c);
         if (c == '\n' || c == '\r') break;
         docursor();
      }
   }
   return str;
}
Exemple #4
0
void
DoDisplay (
    void
	) {

    int Row, Col;

    if (pFileHead == NULL) {
        return;
    }

    if (TESTFLAG (fDisplay, RCURSOR)) {

        Row = YCUR(pInsCur) - YWIN(pInsCur) + WINYPOS(pWinCur);
        Col = XCUR(pInsCur) - XWIN(pInsCur) + WINXPOS(pWinCur);

	if ( Row >= YSIZE || Col >= XSIZE ) {
            docursor( XCUR(pInsCur), YCUR(pInsCur) );
        }
    }

	/*
     * If text needs updating, do so. Return immediately if a keystroke was
     * pressed.
	 */
	if (TESTFLAG (fDisplay, RTEXT) && !DoText (0, YSIZE)) {
		return;
    }

	if ((fDisplayCursorLoc && TESTFLAG (fDisplay, RCURSOR)) ||
	    TESTFLAG (fDisplay, RSTATUS)) {
        DoStatus ();
    }

    if (TESTFLAG (fDisplay, RCURSOR)) {

        Row = YCUR(pInsCur) - YWIN(pInsCur) + WINYPOS(pWinCur);
        Col = XCUR(pInsCur) - XWIN(pInsCur) + WINXPOS(pWinCur);

        consoleMoveTo( Row, Col );
		RSETFLAG (fDisplay, RCURSOR);
	}
}
Exemple #5
0
int inputprocess(){
int junk,junk2,cellw,rfoff=0,lcount=0,wl;
char aflag=FALSE;
char *dp;
int sff=0;
char temps[2048];
	if(cwin==-1)return 0;
	wind_get(wn[cwin].hand,WF_TOP,&junk,&junk2,&junk2,&junk2);
	if(cwin!=-1 && wn[cwin].stat!=WMDONTWRITE && junk==wn[cwin].hand){
	strcpy(chinp,"\0");
	sprintf(chinp,"%c",kreturn);
	if(wn[cwin].scb){sbvslid(1000);wn[cwin].scb=0;}
	
	if(!strncmp("\b",chinp,1) && inpbcontents()){
	vst_font(ws.handle,(WORD)inpfont);
	vst_point(ws.handle,(WORD)inppoint,&junk2,&junk2,&junk2,&junk2);

	clcursor(cwin);
	junk2=findcurpos();
	stccpy(temps,wn[cwin].inp,junk2);
	strcat(temps,wn[cwin].inp+junk2);
	strcpy(wn[cwin].inp,temps);
	if(wn[cwin].cx>0){wn[cwin].cx--;}
	else{
	if(wn[cwin].cvof!=0){
	wn[cwin].cvof--;wn[cwin].cx=wn[cwin].ihc[wn[cwin].cvof]-1;}
	}
	
wl=wn[cwin].cvof;
junk2=wn[cwin].cvof-1;
while(junk2>-1){
rfoff=rfoff+wn[cwin].ihc[junk2];
junk2--;
}
dp=wn[cwin].inp+rfoff;
if(rfoff==strlen(wn[cwin].inp)){wn[cwin].ihc[wl]=0;
wn[cwin].iof[wl]=0;
}
else{
while(rfoff<strlen(wn[cwin].inp)){
vqt_width(ws.handle,*(dp+lcount),&cellw,&junk2,&junk2);
if(sff+cellw>wn[cwin].wwa.g_w){
wn[cwin].ihc[wl]=lcount;
wn[cwin].iof[wl]=sff;
dp=dp+lcount;
lcount=-1;
sff=0;
wl++;
cellw=0;
}
sff=sff+cellw;
lcount++;
rfoff++;
}

wn[cwin].ihc[wl]=lcount;
wn[cwin].iof[wl]=sff;
}
ipbredraw(cwin);
strcpy(chinp,"\0");
	aflag=TRUE;
	}

	if(!strncmp("\b",chinp,1) && !inpbcontents()){
	strcpy(chinp,"\0");
	aflag=TRUE;
	}
	
	if(strlen(wn[cwin].inp)>511){flag=TRUE;}
	
	if(!strncmp("\r",chinp,1)){
	aflag=TRUE;
	strcpy(chinp,"\0");
	gotcmd();
	clearipb(cwin);
	docursor(cwin);
	}
	
	if(!aflag){
	clcursor(cwin);
	wtib(chinp,aflag);
	docursor(cwin);
	strcpy(chinp,"\0");
	}
	
	}
	return 0;
}