dustinblackman / oatmeal

Terminal UI to chat with large language models (LLM) using different model backends, and integrations with your favourite editors!
https://dustinblackman.com/posts/oatmeal/
MIT License
477 stars 23 forks source link

Do not prevent copying text with mouse pointer selection #41

Open andrewbrey opened 7 months ago

andrewbrey commented 7 months ago

Thank you for the very cool project!

I noticed that when setting up crossterm mouse input is captured:

https://github.com/dustinblackman/oatmeal/blob/3049bd5fdec98b1b0b1386df6f305ade3eb64236/src/application/ui.rs#L265-L270

and I think that one result of this is that attempting to highlight (and thus copy in many terminals) a portion of the output with a mouse pointer is not possible. The /copy slash command is helpful for codeblocks, but it's not currently possible to copy out non-codeblock text as far as I can tell.

I'm not sure if this is as simple as simply not capturing the mouse input, but I would personally find it helpful if I was able to select text printed by the TUI and have my terminal's normal behavior of copying the selected/highlighted text still occur :+1:

dustinblackman commented 5 months ago

Hey there! Sorry for the delay.

You're not wrong. I think when I had first started I had needed EnableMouseCapture, but I don't anymore. The only issue is that when highlighting, it also takes the borders of the chat bubble along with it. Example:

│ ``` (1)                                                                                                                                                                                                                          │          █
│ public class PrintNumbers {                                                                                                                                                                                                      │          █
│     public static void main(String[] args) {                                                                                                                                                                                     │          █
│         System.out.println("Hello World!");                                                                                                                                                                                      │          █
│     }                                                                                                                                                                                                                            │          █
│ }                                                                                                                                                                                                                                │          █
│ ```  

So I could disable it for sure, but I'm not sure how to handle the border problem.

andrewbrey commented 5 months ago

@dustinblackman what if you didn't use actual characters to create the chat bubble, but instead just set a background color to symbolize the chat bubble - then there would be no characters included in the highlight :thinking:

0xhaggis commented 3 months ago

This is driving me crazy, too. It's this and one other issue (insertion of line breaks aka word wrapping) that keeps me from using Oatmeal 100% of the time compared to LM Studio.

I don't even care about copying the borders along with text, I'd live with it! Often I just want to copy a small snippet and wouldn't even touch the borders.

If I fork the Oatmeal project, is it as simple as removing EnableMouseCapture, from crossterm::execute!(...) to enable the mouse?