Fixes end truncate behavior

Not sure of a shorter example that reproduces this bug unfortunately.

The issue seems to be from the line:

```javascript
            if (total + index > maxLength) {
                // exceed given `maxLength`, dump everything to clear stack
                content += (string.substring(0, maxLength - total));
```

If the "dump everything" happens then it doesn't add an ellipsis