Code review comment for lp:~michael-sheldon/webbrowser-app/ssl-status

Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

> 365 + onTextChanged: {
> 366 + // Remove any blank lines caused by missing
> entries
> 367 + while(subjectAddress.text.indexOf("\n\n") !=
> -1) {
> 368 + subjectAddress.text =
> subjectAddress.text.replace("\n\n", "\n")
> 369 + }
> 370 + }
>
> Wouldn’t it be much easier to just do that where 'text' is assigned:
>
> text: i18n.tr("[…]").arg([…]).replace(/\n\n/g, "\n")

Yeah, the problem with that was that since it was only a single pass it could leave extra white space when there'd been three blank lines. But I just realised I could match against /\n+/g to fix that, so I've committed a tidier implementation now.

« Back to merge proposal