Wrapping inserts a space which causes copy-paste and url clicking to fail
- Dominant language
- Rust
- Stars
- 3.4k
- Forks
- 126
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 7
Description
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())))
```
2. 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
Contributor guide
Research direction
Start by locating bacon's terminal-output wrapping logic and reproduce the behavior with the pasted code and URL examples from the issue. Confirm that wrapped output no longer gains an extra space, while preserving normal wrapping and making the shown copied text and URL continuous.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100