sindresorhus / Actions

⚙️ Supercharge your shortcuts
https://sindresorhus.com/actions
MIT License
2.49k stars 103 forks source link

Truncate indicator causes odd issues with truncation #200

Closed chrisgrande closed 7 months ago

chrisgrande commented 7 months ago

Truncate action seems to take the indicator into account for the number of characters, causing unexpected results:

https://github.com/sindresorhus/Actions/assets/825577/c3c2e700-cde3-47bf-a8c3-4389a8a512a2


Actions 2.10.0 (51) - com.sindresorhus.Actions macOS 14.2.0 Mac14,12

sindresorhus commented 7 months ago

That is expected behavior and how most truncation features work. The length is the final string, which includes the truncation character.

chrisgrande commented 7 months ago

I guess it just feels wrong then? The way the action is laid out it reads as, "Truncate this string to this number of characters and add this indicator after." — which is how I expected it to work. The 'add this indicator after' part isn't even initially clear since it's hidden under more.

The default indicator add some oddities as well because while I and some might know the ... is an ellipsis and is considered a single character a vast amount of others might assume it to be three periods, breaking any type of mental model a user might try to form. "Hello with ..." becoming "H..." when truncated to 2 characters, for example.

sindresorhus commented 7 months ago

I will clarify it in the docs in the next update.