[GH-ISSUE #1027] Can not select texts with EnableMouse(true) #743

Open
opened 2026-03-04 01:07:26 +03:00 by kerem · 2 comments
Owner

Originally created by @rush1kesh-010 on GitHub (Sep 25, 2024).
Original GitHub issue: https://github.com/rivo/tview/issues/1027

When we have Application.EnableMouse(true) , we can not select any text with mouse drag in the terminal.

Is it possible to use mouse events while allowing selection of texts with mouse drag?

Here's what I mean by selecting text using mouse drag:
image

Originally created by @rush1kesh-010 on GitHub (Sep 25, 2024). Original GitHub issue: https://github.com/rivo/tview/issues/1027 When we have `Application.EnableMouse(true)` , we can not select any text with mouse drag in the terminal. Is it possible to use mouse events while allowing selection of texts with mouse drag? Here's what I mean by selecting text using mouse drag: ![image](https://github.com/user-attachments/assets/5ec575f6-e083-46a4-94ea-9facbe5b2ac1)
Author
Owner

@rivo commented on GitHub (Sep 25, 2024):

It works for me in iTerm2 on macOS. Could it be that you need to enable it in your terminal software?

If your terminal software doesn't support selections while forwarding mouse events to the app running inside, there is not much tview can do about it. For example, TextArea and InputField do support text selections but it all happens inside the app. If you want to copy+paste this "emulated" selection like you're used to in non-mouse mode, it's not going to work because your terminal won't have any information about that selection. Unless, of course, your app has access to your local clipboard (which is possible but not very common because it's highly OS-dependent). I don't think this is something you intend to implement.

By the way, if your terminal supports it, you can add hyperlinks to the text, see here. Your screenshot seemed like you might want to make those URLs clickable.

<!-- gh-comment-id:2375225118 --> @rivo commented on GitHub (Sep 25, 2024): It works for me in iTerm2 on macOS. Could it be that you need to enable it in your terminal software? If your terminal software doesn't support selections while forwarding mouse events to the app running inside, there is not much `tview` can do about it. For example, `TextArea` and `InputField` do support text selections but it all happens inside the app. If you want to copy+paste this "emulated" selection like you're used to in non-mouse mode, it's not going to work because your terminal won't have any information about that selection. Unless, of course, your app has access to your local clipboard (which is possible but not very common because it's highly OS-dependent). I don't think this is something you intend to implement. By the way, if your terminal supports it, you can add hyperlinks to the text, see [here](https://pkg.go.dev/github.com/rivo/tview#hdr-Styles__Colors__and_Hyperlinks). Your screenshot seemed like you might want to make those URLs clickable.
Author
Owner

@rush1kesh-010 commented on GitHub (Sep 26, 2024):

Yes, holding shift bypasses the mouse event forwarding in GNOME terminal in ubuntu, and I can select text using this method.

But for Windows cmd and powershell, there is no bypassing supported for mouse event forwarding. I need to open the Window Control Menu and click Edit->Mark to enter text selection mode in Windows terminals.

Is it possible to make the gnome terminal by default select text like MacOS?

<!-- gh-comment-id:2377493975 --> @rush1kesh-010 commented on GitHub (Sep 26, 2024): Yes, holding shift bypasses the mouse event forwarding in GNOME terminal in ubuntu, and I can select text using this method. But for Windows cmd and powershell, there is no bypassing supported for mouse event forwarding. I need to open the Window Control Menu and click `Edit->Mark` to enter text selection mode in Windows terminals. Is it possible to make the gnome terminal by default select text like MacOS?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#743
No description provided.