Hi, Micah
  There are some other bugs, we fixed.
1. in widget/textedit_logical.c, old code in most skins cause pgserver crashed.

#ifdef CONFIG_HANDINFO_FIXED  
g_error text_backend_build ( text_widget * widget,
                             s16 w,
                             s16 h ) {
#else
g_error text_backend_build ( text_widget * widget,
                             u16 w,
                             u16 h ) {
#endif

2.in widget/textedit_logical.c, we must judge if the buffer had chars.

g_error text_backend_set_selection ( text_widget * widget,
                                     struct pgstring * text ) {
    g_error e;
#ifdef CONFIG_TEXTEDIT_WCHART
    wchar_t * wBuffer;
#ifdef CONFIG_HANDINFO_FIXED
   if (!text->buffer || text->num_chars == 0)
   {
     return success;
   }
#endif
....

}

 3. in gcore/pgstring.c pgstr_utf8_seek function, we handle negative char_num, that be 
used in textbox widget if we want to support utf8 code (Chinese). but this code is vey 
ugly and slow and it can work.


void pgstr_utf8_seek(const struct pgstring *str, struct pgstr_iterator *p, s32 
char_num, int whence) {
  int num = 0, savenum = 0;
  struct pgstr_iterator temp_iterator;
  switch (whence) {

  case PGSEEK_SET:
    p->offset = 0;
    break;

  case PGSEEK_END:
#ifdef CONFIG_HANDINFO_FIXED
   if (str->num_chars == 0) 
     p->offset = 0;
   else
#endif
     p->offset = str->num_chars - 1;
    break;
  }
  /* FIXME: handle negative char_num by sanit Handinfo Ltd.*/
#ifdef CONFIG_TEXTBOX_SUPPORT_UTF8
  if (char_num >= 0)
  {
#endif
    while (char_num) {
      if (!pgstring_decode(str,p))
        return;
      char_num--;
    }
#ifdef CONFIG_TEXTBOX_SUPPORT_UTF8
  }else
  {
    if ((num = char_num + str->num_chars) <= 0)
      p->offset = 0;
    else
    {
      temp_iterator = *p;
      temp_iterator.offset = 0;

      /*FIXED ME this is a very urgly code, sanit */
      savenum = str->num_chars;

      while (savenum) {
        if (!pgstring_decode(str,&temp_iterator))
          return;
 if (temp_iterator.offset == p->offset)
 {
   break;
 }
        savenum--;
      }
      if (savenum == 0)
 return;

      num = str->num_chars - savenum;
      temp_iterator.offset = 0;

      while (num) {
        if (!pgstring_decode(str,&temp_iterator))
          return;
        num--;
      }
      *p = temp_iterator;
    }
  }
#endif
}


                                                                  
sanitN���޵隊X���'���u���)��Y�\�g�����������b�HzG(��>�u�ޖf��)��+->�u�ޖX���(��~��zw���i����l���q���z���l�X��)ߣ�`�'^��


Reply via email to