Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrapping inserts a space which causes copy-paste and url clicking to fail #125

Open
joshka opened this issue Apr 1, 2023 · 2 comments
Open

Comments

@joshka
Copy link

joshka commented Apr 1, 2023

When the terminal width is not as wide as the message, the message wraps (which is good). The problem however is that at the wrap point, a space is inserted. This prevents terminal apps (iterm2 in my case) from detecting that a url has continued onto the next line. It also inserts a space into any text copied, which makes it annoying to copy past a suggested fix.

Example:

 1  warning: use Option::map_or_else instead of an if let/else
    --> src/view/login.rs:180:21
     |
 180 | /                     match self.authentication_code.as_ref() {
 181 | |                         Some(code) => Transition::To(LoginState::Com.
 ..
 182 | |                         None => Transition::None,
 183 | |                     }
     | |_____________________^ help: try: `self.authentication_code.as_ref().m
 ap_or_else(|| Transition::None, |code| Transition::To(LoginState::CompleteAut
 hentication(registered.clone(), code.clone())))`
     |
     = help: for further information visit https://rust-lang.github.io/rust-cl
 ippy/master/index.html#option_if_let_else
     = note: `-W clippy::option-if-let-else` implied by `-W clippy::nursery`

Causes two problems:

  1. This cannot be pasted as a solution to the problem:
self.authentication_code.as_ref().m
 ap_or_else(|| Transition::None, |code| Transition::To(LoginState::CompleteAut
 hentication(registered.clone(), code.clone())))
  1. This cannot be clicked to understand the problem better:
https://rust-lang.github.io/rust-cl
 ippy/master/index.html#option_if_let_else

Suggested fix:
Don't add the extra space when wrapping

@Canop
Copy link
Owner

Canop commented Apr 2, 2023

If we remove this indentation, you'll still have the problem due to the scrollbar, as soon as the report doesn't fit the height.

@joshka
Copy link
Author

joshka commented Apr 3, 2023

Hrm, I didn't realize that there was a scrollbar :D
You're right that is a problem. A workaround that could work might be to wrap urls in OSC 8 sequences (though perhaps that should be an upstream request on clippy. Do you happen to know how much processing of the clippy output gets done? Would OSC codes like this be passed through verbatim, or need to be explicitly handled by bacon?

TL;DR in case you've never seen this, the OSC 8 escape sequence:

printf '\e]8;;http://example.com/long-link-that-spans-multiple-lines\e\\https://example.com/long-link-\nthat-spans-multiple-lines\e]8;;\e\\\n'

Makes links clickable as the full link not the truncated link:
image

That addresse problem 2, but not problem 1. My guess is that problem 1 would only be fixable by turning off the scroll bar (perhaps moving the scroll position to the status bar?)

This is not a high priority item - more an annoyance than anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants