tmux-copycat icon indicating copy to clipboard operation
tmux-copycat copied to clipboard

URL matcher does not work when URL wraps in terminal

Open windowsrefund opened this issue 9 years ago • 6 comments

Came across this when reading some non-wrapped mail in mutt which contained several URLs.

Love your plugins btw. Thanks for each and every one.

windowsrefund avatar Jan 02 '15 17:01 windowsrefund

Hey, thanks for taking the time to report.

So, are you getting the scenario where only the part of the match in the first line is highlighted? As shown on the screenshot below? screen shot 2015-01-02 at 6 38 31 pm

If this is it, unfortunately I'm not sure what can be done :( From what I know grep (we're using it for matching) can't go multiline consistently.

On the other hand, extending the highlighted area is easy, by just pressing e once or twice.

Anyway, I'm not sure what action do take except making this as a known bug and hoping it doesn't occur too often.

Love your plugins btw. Thanks for each and every one.

Thank you!

bruno- avatar Jan 02 '15 17:01 bruno-

yes exactly. The 'e' trick is ok as pressing it once highlighted the remaining portion of the URL

windowsrefund avatar Jan 02 '15 18:01 windowsrefund

Things are getting a bit more interesting when I bring tmux-open into the mix. On a terminal-wrapped URL, try the following:

Prefix+u <navigate to wrapped URL> e <complete URL should now be highlighted across 2 lines> o I think you'll find only the first half of the URL is (unsuccessfully) loaded into your browser despite the extra step taken to extend the highlight.

windowsrefund avatar Jan 02 '15 18:01 windowsrefund

This looks to be the same issue for me. I have a tmux window split into several panes, and any wrapped output lines with URLs (or file paths etc) can't be searched using copycat; only the first matching part gets picked up. Does tmux understand line wrapping inside a pane? If not, there's probably no easy option since as you say it's grep.

davidjb avatar May 11 '15 01:05 davidjb

Hi guys, after more investigation I think solving this is theoretically possible. There's a -J flag for tmux capture-pane that enables dumping tmux scrollback without line wraps (it does "respect" normal new-lines). This means that even though the lines on the screen are wrapped, they will not be wrapped when dumped to a file.

So now grepping this file without additional line wraps should return correct/full results.

However, when this -J flag is enabled here, things break apart. Now that results are ok, locating a correct line with the result in tmux copy mode breaks. I didn't go further than this .. If someone wants to try to make this work that would be great.

bruno- avatar May 11 '15 10:05 bruno-

One workaround found for this and Ctrl/Cmd+click is to briefly Prefix+Z to "zoom" the pane to full screen (then the build in terminal URL handling works at least). I haven't tested with Tmux-copycat to see if it also resolves it's handling.

dragon788 avatar Jan 25 '18 18:01 dragon788