1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-23 21:32:13 +03:00

fix copying trailing whitespace from wrapped lines

refs: #1635
This commit is contained in:
Wez Furlong 2022-02-12 09:47:03 -07:00
parent 3b209c671d
commit 18c63c0526
2 changed files with 10 additions and 1 deletions

View File

@ -66,6 +66,7 @@ As features stabilize some brief notes about them will accumulate here.
* Shaping combining sequences like `e U+20d7` could "lose" the vector symbol if the font produced an entry with no `x_advance`. [#1617](https://github.com/wez/wezterm/issues/1617)
* Setting the cursor color via escape sequences now take precedence over `force_reverse_video_cursor`. [#1625](https://github.com/wez/wezterm/issues/1625)
* Fixed Detection of DECSDM support via DECRQM/DECRPM, Correct sixel image placement when DECSDM is set and VT340 default sixel colors. Thanks to [Autumn](https://github.com/autumnmeowmeow)! [#1577](https://github.com/wez/wezterm/pull/1577)
* Fixed missing whitespace from intermediate lines when copying a wrapped logical line [#1635](https://github.com/wez/wezterm/issues/1635)
### 20220101-133340-7edc5b5a

View File

@ -21,13 +21,21 @@ impl super::TermWindow {
if !s.is_empty() && !last_was_wrapped {
s.push('\n');
}
let last_idx = line.physical_lines.len().saturating_sub(1);
for (idx, phys) in line.physical_lines.iter().enumerate() {
let this_row = line.first_row + idx as StableRowIndex;
if this_row >= first_row && this_row < last_row {
let last_phys_idx = phys.cells().len().saturating_sub(1);
let cols = sel.cols_for_row(this_row);
let last_col_idx = cols.end.saturating_sub(1).min(last_phys_idx);
s.push_str(phys.columns_as_str(cols).trim_end());
let col_span = phys.columns_as_str(cols);
// Only trim trailing whitespace if we are the last line
// in a wrapped sequence
if idx == last_idx {
s.push_str(col_span.trim_end());
} else {
s.push_str(&col_span);
}
last_was_wrapped = last_col_idx == last_phys_idx
&& phys