Example #1
0
File: MOVE.C Project: MegaGod/TW
void backword( unsigned int *x ) {
	int i;
	i = *x + firstcol + 1;
	if ( i != 1 ) {   /* first column ? */
		if ( ( !ISBLANK( workline.middle[i] ) ) && ( !ISBLANK( workline.middle[i - 1] ) ) ) {
			while ( ( !ISBLANK( workline.middle[i] ) ) && ( i > 0 ) ) {
				i--;
			}
		} else {
			if ( ISBLANK( workline.middle[i - 1] ) ) {
				i--;
			}
			while ( ISBLANK( workline.middle[i] ) && ( i > 0 ) ) {
				i--;
			}
			while ( !ISBLANK( workline.middle[i] ) && ( i > 0 ) ) {
				i--;
			}
		}
		gocol( i, x );
		if ( ( i == 0 ) && ( ISBLANK( workline.middle[1] ) ) ) {
			backword( x );
		}
	} else {
		if ( curline->previous != sentinel ) {
			cursor_up( );
			endline( x );
		}
	}
}
Example #2
0
void cursor_left( unsigned *x ) {
	unsigned i = *x + firstcol;
	if ( i != 0 ) {    /* Home of line ? */
		gocol( i - 1, x );
	} else {
		if ( curline->previous != sentinel ) {
			cursor_up( );   /* go to end of  */
			endline( x );    /* previous line */
		}
	}
}
Example #3
0
void cursor_left( unsigned int *p_xCursorPos ) {
	unsigned int i = *p_xCursorPos + firstcol;

	if ( i != 0 ) {    /* Home of line ? */
		gocol( i - 1, p_xCursorPos );
	} else {
		if ( curline->previous != sentinel ) {
			cursor_up( );   /* go to end of  */
			endline( p_xCursorPos );    /* previous line */
		}
	}
}
Example #4
0
void movetotab(unsigned *x,unsigned y)
{
    int i,count;
    if ((*x + firstcol) >= (leftmar - 1)) {
      i = *x + firstcol + 1;
    } else {
      i = leftmar - 1;
    }
    for(;(tab[i] != YES) && (i < (rightmar-1));i++);
    if (i < (rightmar - 1)) {
      count = i - (*x + firstcol);
      while (count-- != 0) {
        if (insertmode)
          insertblank(*x + firstcol + 1,' ');
      }
      gocol(i,x);
      refreshline(0,y);
    }
}
Example #5
0
File: MOVE.C Project: MegaGod/TW
void nextword( unsigned int *x, unsigned int y ) {
	int i, j;
	i = *x + firstcol + 1;
	j = i;
	while ( !ISBLANK( workline.middle[i] ) && ( i != MAXCOL ) ) {
		i++;
	}
	while ( ISBLANK( workline.middle[i] ) && ( i != MAXCOL ) ) {
		i++;
	}
	if ( i != MAXCOL ) {
		i--;
		gocol( i, x );
	} else {
		endline( x );
		if ( ( *x + firstcol + 1 ) <= j ) {
			cursor_down( y );
			home( x );
			if ( ISBLANK( workline.middle[1] ) ) {
				nextword( x, y );
			}
		}
	}
}
Example #6
0
File: MOVE.C Project: MegaGod/TW
void endline( unsigned int *x ) {
	gocol( strlen( workline.middle ) - 1, x );
}
Example #7
0
File: MOVE.C Project: MegaGod/TW
void goendblk( unsigned int *x ) {
	if ( haveblock( ) ) {
		goline( blkend.lineno );
		gocol( blkend.column, x );
	}
}
Example #8
0
File: MOVE.C Project: MegaGod/TW
void gobeginblk( unsigned int *x ) {
	if ( haveblock( ) ) {
		goline( blkbegin.lineno );
		gocol( blkbegin.column, x );
	}
}
Example #9
0
File: WRAP.C Project: MegaGod/TW
void autowrap( unsigned int *x, unsigned int *y ) {
	unsigned int i, j, already = NO, diff;
	char *temp1, *temp3, *cuthere, fontcode[9];
	font_attr font = 0;
	struct line_node *templine;

	storeline( curline );
	diff = strlen( workline.middle ) - ( *x + firstcol + 1 );
	i = 0;
	j = 0;
	while ( curline->text[i] != '\0' ) {
		if ( curline->text[i] != WRAPBLANK ) {
			curline->text[j] = curline->text[i];
			j++;
			already = YES;
		} else {
			if ( already == NO ) {
				curline->text[j] = curline->text[i];
				j++;
			}
		}
		i++;
	}
	curline->text[j] = '\0';
	temp1 = curline->text;
	for ( i = rightmar - 2; ( i > 0 ) && ( *temp1 != '\0' ); i-- ) {
		temp1++;
		while ( whatlevel( *temp1 ) != MIDDLE ) {
			temp1++;
		}
	}
	temp3 = temp1;
	for ( i = 10; ( i != 0 ) && ( *temp3 != '\0' ); i-- ) {
		temp3++;
	}
	cuthere = FINDCUT( curline->text, temp3, temp1 );
	cuthere++;
	for ( temp1 = curline->text; temp1 != cuthere; temp1++ ) {
		if ( *temp1 < 32 ) {
			togglefont( &font, *temp1 );
		}
	}
	findstrcode( fontcode, font );
	templine = ( struct line_node * ) malloc( sizeof( struct line_node ) );
	templine->text = ( char * ) malloc( leftmar + strlen( fontcode ) + strlen( cuthere ) );
	for ( i = 0; i != ( leftmar - 1 ); i++ ) {
		templine->text[i] = WRAPBLANK;
	}
	templine->text[i] = '\0';
	strcat( templine->text, fontcode );
	strcat( templine->text, cuthere );
	templine->graph = NULL;
	templine->wrap = ( curline->next )->wrap;
	*cuthere = '\0';
	temp3 = ( char * ) malloc( strlen( curline->text ) + strlen( fontcode ) + 1 );
	strcpy( temp3, curline->text );
	strcat( temp3, fontcode );
	free( curline->text );
	curline->text = temp3;
	templine->next = curline->next;
	( curline->next )->previous = templine;
	templine->previous = curline;
	curline->next = templine;
	curline->wrap = YES;
	loadtoline( curline->text );
	justify_right( );
	*y = findrow( );
	cursor_down( *y );
	firstcol = 0;
	gocol( strlen( workline.middle ) - 1 - diff, x );
	pagecomplete = NO;
}