Fix cannot select in terminal when copy_on_select is enabled (#34131)

Closes #33989


![terminal_select](https://github.com/user-attachments/assets/5027d2f2-f2b3-43a4-8262-3c266fdc5256)

Release Notes:

- N/A
84124c60dbfeeiyu committed on 7/14/2025, 11:04:54 AM· committed by GitHubparentcf1ce1b
2 files changedLine totals unavailable