Textualize / rich-cli

Rich-cli is a command line toolbox for fancy output in the terminal
https://www.textualize.io
MIT License
3.04k stars 75 forks source link

select/copy/find during --pager? #53

Closed mlibbey closed 2 years ago

mlibbey commented 2 years ago

I've been trying rich --pager as a less pager replacement. I've realized that I can't select words while in that mode, which prevents copy. Is there a way to allow selecting of words? (and ideally some sort of find?)

willmcgugan commented 2 years ago

Hold down Command or Ctrl.

Re find, we might implement that in the future.

davidfokkema commented 2 years ago

This does not seem to work on iTerm2 version 3.4.16 with rich-cli version 1.8.0. Holding down Cmd will highlight things that iTerm seem to think are http links, but selection is not possible. Ctrl-mouse click will immediately bring up a menu. Am I holding it wrong?

willmcgugan commented 2 years ago

Try option

davidfokkema commented 2 years ago

That works, thanks! How... could I have known this? Is this documented somewhere or would it be possible to just allow selecting text without holding the option key?

willmcgugan commented 2 years ago

It’s not something Textual can control. It’s a feature of you terminal.

davidfokkema commented 2 years ago

Ah, I see. I never encountered this before (vim, less, top work fine) but I guess it has to do with Textual being able to respond to mouse events. According to the iTerm2 docs, holding down Option disables mouse reporting and is needed for some applications. Learned something today, thanks! If I'm not the only one, maybe add a 'gotcha' to the rich-cli/textual docs? 😇

harkabeeparolus commented 2 years ago

[...] I guess it has to do with Textual being able to respond to mouse events. According to the iTerm2 docs, holding down Option disables mouse reporting and is needed for some applications.

This is correct. Terminal applications with mouse support in terminals catch mouse events such as click and drag, that you'd normally use to select text. It's been this way for decades. This can be really annoying if you're uninterested in clicking buttons and just want to copy text, but most terminals do have some way around it. 😊