Edgewall Software

Ticket #9484: textarea_email_formatting_2.patch

File textarea_email_formatting_2.patch, 1.4 KB (added by andrew.c.martin@…, 23 months ago)
  • trac/ticket/notification.py

     
    139139                            new = obfuscate_email_address(new) 
    140140                        newv = new 
    141141                        l = 7 + len(field) 
    142                         chg = wrap('%s => %s' % (old, new), self.COLS - l, '', 
    143                                    l * ' ', CRLF) 
    144                         changes_body += '  * %s:  %s%s' % (field, chg, CRLF) 
     142                        spacer_old = ' ' 
     143                        spacer_new = ' ' 
     144                        if len(old + new) + l > self.COLS: 
     145                            l = 5 
     146                            if len(old) + l > self.COLS: 
     147                                spacer_old = CRLF 
     148                            if len(new) + l > self.COLS: 
     149                                spacer_new = CRLF 
     150                        chg = '* %s: %s%s%s=>%s%s' % (field, spacer_old,  
     151                            old, spacer_old, spacer_new, new) 
     152                        chg = chg.replace(CRLF, CRLF + l * ' ') 
     153                        chg = wrap(chg, self.COLS, '', l * ' ', CRLF) 
     154                        changes_body += ' %s%s' % (chg, CRLF) 
    145155                    if newv: 
    146156                        change_data[field] = {'oldvalue': old, 'newvalue': new} 
    147157