X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=lib%2Fthread.cc;h=50bdef11aa8cba0f2240a142052a2ee249d74df1;hp=c126aac8cc8b945e9018f7505f7910174c83535e;hb=f55b35b3df4d8708dfba0e95e33877305fd9f8d9;hpb=a629b2e1cb5be87abf7914730c80620e6a8c1139 diff --git a/lib/thread.cc b/lib/thread.cc index c126aac8..50bdef11 100644 --- a/lib/thread.cc +++ b/lib/thread.cc @@ -190,8 +190,16 @@ _thread_cleanup_author (notmuch_thread_t *thread, if (comma && strlen(comma) > 1) { /* let's assemble what we think is the correct name */ lname = comma - author; - fname = strlen(author) - lname - 2; - strncpy(clean_author, comma + 2, fname); + + /* Skip all the spaces after the comma */ + fname = strlen(author) - lname - 1; + comma += 1; + while (*comma == ' ') { + fname -= 1; + comma += 1; + } + strncpy(clean_author, comma, fname); + *(clean_author+fname) = ' '; strncpy(clean_author + fname + 1, author, lname); *(clean_author+fname+1+lname) = '\0';