Repository: wezterm/wezterm (language: rust)

Issue:
Investigation "Wrapped long line copy under tmux"
### What Operating System(s) are you seeing this problem on?

Windows

### Which Wayland compositor or X11 Window manager(s) are you using?

_No response_

### WezTerm version

wezterm 20231228-084719-ff274374

### Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

Yes, and I updated the version box above to show the version of the nightly that I tried

### Describe the bug

Hi.
First, I really liked to use wezterm on my daily work and I satisfied most of features.
One thing I am having a problem is that copying single logical line on multiple physical line on tmux.
I also searched issues on the board and I found already closed issues such as https://github.com/wez/wezterm/issues/4706 and https://github.com/wez/wezterm/issues/5016.

I spent some time to debug why this is happening on tmux and I found the reason should_mark_wrapped is set to false when alt screen is on.
https://github.com/wez/wezterm/blob/cce0706b1f2a9e2d1f02c57f2d1cd367c91df1ae/term/src/terminalstate/performer.rs#L165

I confirmed that it worked as expected after removing '!is_alt'

Can we remove this condition ? Or is there any reason for checking is_alt ?


### To Reproduce

_No response_

### Configuration

no config

### Expected Behavior

logical single line should be copied as single line.

### Logs

_No response_

### Anything else?

_No response_


Discussion / hints:
The main reason is this, and it pertains to re-flowing text on resize:

https://github.com/wez/wezterm/blob/cce0706b1f2a9e2d1f02c57f2d1cd367c91df1ae/term/src/terminalstate/performer.rs#L146-L149

the consequence of changing this is that it would make resizing more expensive for full-screen apps like editors, and there is potential for wezterm to compete with the application when it comes to re-drawing the screen contents, although I'm not sure if that would be as bad as it would be for eg: a shell in non-alt mode.

If you can try a few different tui apps (not just tmux) and try aggressively and quickly resizing them to see if things work ok, then I'd be open to a PR for that small change.




Fix patch:
diff --git a/term/src/terminalstate/performer.rs b/term/src/terminalstate/performer.rs
index 80f9d6dd261..59c043319ce 100644
--- a/term/src/terminalstate/performer.rs
+++ b/term/src/terminalstate/performer.rs
@@ -162,14 +162,13 @@ impl<'a> Performer<'a> {
                         }
                     }
 
-                    let should_mark_wrapped = !is_alt
-                        && (!is_conpty
-                            || screen
-                                .line_mut(y)
-                                .visible_cells()
-                                .last()
-                                .map(|cell| makes_sense_to_wrap(cell.str()))
-                                .unwrap_or(false));
+                    let should_mark_wrapped = !is_conpty
+                        || screen
+                            .line_mut(y)
+                            .visible_cells()
+                            .last()
+                            .map(|cell| makes_sense_to_wrap(cell.str()))
+                            .unwrap_or(false);
                     if should_mark_wrapped {
                         screen.line_mut(y).set_last_cell_was_wrapped(true, seqno);
                     }


Test patch: