If you select anything on chat, the last symbol will have one line of pixels that didn't get selected. Except if you have a space at the end.
Steps to Reproduce:
Paste the following characters into the chat but don't press enter.
aaaaaaaaaaaaaaaaa
Highlight the text by pressing (CTRL + A).
→ ✔ Notice how the shadow of the character on the far right is highlighted.
Deselect the text.
Highlight the text by pressing (CTRL + SHIFT + LEFT ARROW).
→ ❌ Notice how the shadow of the character on the far right is not highlighted.
I can confirm that this is an issue in 1.17.1. It appears that the shadow of the character on the far right doesn't get selected when highlighted, depending on how you highlighted the text. This could be intentional however, to clear up any confusion, here are some steps to reproduce this issue.
Steps to Reproduce:
Paste the following characters into the chat but don't press enter.
Highlight the text by pressing (CTRL + A).
→ ✔ Notice how the shadow of the character on the far right is highlighted.
Deselect the text.
Highlight the text by pressing (CTRL + SHIFT + LEFT ARROW).
→ ❌ Notice how the shadow of the character on the far right is not highlighted.