Composer address bar: prevent doubling spaces after address autocomplete

The composer splits addresses on "," and later joins them on ", ". This means
that separating spaces are doubled after every autocomplete. This patch fixes
that by stripping whitespace after splitting. We do this in a separate loop at
the end of the function as opposed to directly after splitting in order not to
upset the cursor positioning logic.

This does not fix the problem that an address like

    "Kluck, Timo" <tkluck@infty.nl>

are split on the comma. Before this patch, the space would be doubled.  After
this patch, it will always be reduced to a single space. A better solution
would ideally leave the quoted part as-is. I think this will also lead to
better auto-complete behaviour when the cursor is in the quoted part.  Better
parsing of the quoted part is beyond the scope of this patch.
This commit is contained in:
Timo Kluck 2015-09-24 22:21:11 +02:00 committed by Michael James Gratton
parent a2519ff30e
commit 5045ff0443

View file

@ -130,6 +130,9 @@ public class ContactEntryCompletion : Gtk.EntryCompletion {
}
bytes_seen_so_far += token_bytes;
}
for (int i = 0; i < addresses.size; i++) {
addresses[i] = addresses[i].strip();
}
return addresses;
}