Пример #1
0
static void	move_ant_next(t_list *list)
{
	ft_putchar('\n');
	move_end(list);
	if (som_in(list) == 1)
		move(list);
}
Пример #2
0
inline bool find_moverange(double minlength, uint startindex,
			   uint &movestart,  uint &moveend,
			   const vector<PLine3> &lines)
{
  uint i = startindex;
  uint num_lines = lines.size();
  while (i < num_lines-2) {
    if (move_start (i, movestart, lines)) {        // find move start
      if (!move_end (movestart, moveend, lines)) {// find move end
	i = movestart+1;
	continue;
      }
      if ( Printlines::length(lines, movestart, moveend) >= minlength )
	return true;
    }
    else return false; // not found
    i = moveend+1; // not long enough, continue search
  }
  return false;
}
Пример #3
0
int readline(char *str_line)
{
	int c;

	memset(line, 0, STR_LINE_SIZE);
	offset = 0;
	len = 0;

	do{
		c = term_getc();
	
/*
		printf("c = %d\n", c);

		if( is_send_signal_int() )
		{
			fprintf(stderr, "sig");
			term_putc('\n');
			str_line[0] = '\0';

			return 0;
		}
*/
		switch( c )
		{
			case -1 :
				fprintf(stderr, "\n-1\n");
			break;

			case '\n' :
				term_putc('\n');
			break;

			case 1 :
				move_begin();
			break;

			case 5 :
				move_end();
			break;

			case 127 :
				backspace();
				history_backup_current_line(line);
			break;

			case 27 :
				switch( (c = term_getc()) )
				{
					case 91 :
						switch( (c = term_getc()) )
						{
							case 65 :
								move_up();
							break;
							case 66 :
								move_down();
							break;

							case 68 :
								move_left();
							break;
							case 67 :
								move_right();
							break;

							default:
								//printf("c = %d\n", c);
							break;
						}
					break;
				}
			break;

			default :
				//printf("c = %d\n", c);
				if( c >= ' ' )
				{
					append(c);
					history_backup_current_line(line);
				}
			break;
		}
	}while( c != '\n' );

	history_add(line);
	history_backup_current_line("");

	memcpy(str_line, line, len+1);

	return len;
}