Ejemplo n.º 1
0
int
show_candidate(candidate_info *cand)
{
  int i;
  int page;
  int index;

  if (cand->num == 0) {
	a_printf("( e )");
	return 0;
  }

  index = cand->index;
  if (cand->disp_limit)
    page = index / cand->disp_limit;
  else
    page = 0;

  a_printf("( c ");

  a_printf(" ( %d . %d ) ",  cand->index + 1,  cand->num);

  for (i = cand->disp_limit * page;
	   i < (cand->disp_limit ? cand->disp_limit * (page + 1) : cand->num);
	   i ++) {

	if (i >= cand->num) break;

	if (i == index)
	  a_printf("( t ");
	else
	  a_printf("( nil ");

	output_with_escape(cand->cand_array[i].label);

	a_putchar(' ');

	output_with_escape(cand->cand_array[i].str);

	a_printf(" ) ");
  }

  a_printf(") ");

  return 1;
}
Ejemplo n.º 2
0
Archivo: preedit.c Proyecto: NgoHuy/uim
int
show_preedit(preedit *pe)
{
  preedit_buffer *p;

  p = pe->head;

  if (p == NULL || pe->length == 0) {
	a_printf(" ( e ) ");
	return 0;
  }

  a_printf("( p ");

  while (p) {
	a_printf(" ( ");
	if (p->attr & UPreeditAttr_Reverse)
	  a_putchar('r');
	if (p->attr & UPreeditAttr_UnderLine) 
	  a_putchar('u');
	if (p->attr & UPreeditAttr_Cursor) 
	  a_putchar('c');
	if (p->attr & UPreeditAttr_Separator)
	  a_putchar('s');

	a_putchar('t');
	a_putchar(' ');

	output_with_escape(p->str);

	a_printf(" ) ");

	p = p->next;
  }
  a_printf(" ) ");

  return 1;
}