Trim trailing spaces of the input, instead of manually trimming, thus improving the user experience. Fixes #12279 ### Screencast [Screencast from 2025-05-26 21-03-54.webm](https://github.com/user-attachments/assets/cc40be5a-d260-4a20-bbc8-c0b21ddbbd9b) --------- Co-authored-by: Devessier <baptiste@devessier.fr>