Skip to content

Commit

Permalink
Only put nbsp before last token in msg body if token is <12 chars
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnonnenberg-signal committed Mar 13, 2019
1 parent ba501a6 commit eb7ad48
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions js/models/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,11 +458,10 @@
const nbsp = '\xa0';
const regex = /(\S)( +)(\S+\s*)$/;
return text.replace(regex, (match, start, spaces, end) => {
const newSpaces = _.reduce(
spaces,
accumulator => accumulator + nbsp,
''
);
const newSpaces =
end.length < 12
? _.reduce(spaces, accumulator => accumulator + nbsp, '')
: spaces;
return `${start}${newSpaces}${end}`;
});
},
Expand Down

0 comments on commit eb7ad48

Please sign in to comment.