Problem with address-entry



	Hi all,
I'm trying to reenable hightlighting of alias in address-entry, but it 
seems like this does not play very well with Peter's patch. In fact it 
seems that calling gtk_editable_select_region(3) or 
gtk_editable_claim_selection will force the cursor to be in the region, so 
that the widget just crashes with a g_assert that is not satisfied (in 
libbalsa_address_entry_find to be exact). So now I understand why there 
were all this duplicated code in address-entry, it was partly to work 
around that problem.
Peter have you worked on the problem.

Here is the code I changed to re-enable the highlighting : at the end of 
libbalsa_address_entry_show I have changed the 4 lines mentionned because 
you ended up always with start=end=0 with the preceding code so you never 
selected anything.

     /*
      * Show it...
      */
     address_entry->alias_start_pos = start;
     address_entry->alias_end_pos = end;
->    if (editable->selection_start_pos!=editable->selection_end_pos) {
->        start = editable->selection_start_pos;
->        end = editable->selection_end_pos;
->    }
     tmp_pos = 0;
     gtk_editable_delete_text(editable, 0, -1);
     gtk_editable_insert_text(editable, show->str, show->len, &tmp_pos);
     g_print("cursor=%d, start=%d,end=%d\n",cursor,start,end);
     gtk_editable_set_position(editable, cursor);
     g_string_free(show, TRUE);
     gtk_editable_select_region(editable, start, end);

But with that change you'll see problems whenever an alias pop up : first 
little drawings problems where the cursor should be, then it will abort 
with a g_assert failure. I think this is because of that gtk_editable 
assumes that the cursor must be in the selected region (and I saw that 
when you select a region it forces the cursor to be in, so that our input 
structures are no more coherent with the widget and crash...)
Tell me if you find something to solve that.
Bye
Manu



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]