Skip to content

Commit

Permalink
ConPTY: allow for unbroken copying of long lines
Browse files Browse the repository at this point in the history
On Windows, ConPTY does not support 'WRAPLINE', meaning that the lines in a copied
selection were incorrectly 'hard wrapped' with a newline character, even
if the line should not have been broken.

This change makes it such that lines are hard-wrapped if:

    * the length of the selection is >= the number of columns in the
      terminal; and

    * the final column is a space (not final letter, final column)

That is, if you make a selection that is wide as the terimal *and* the
last line *is not* a space, your selection is not broken with newlines.
  • Loading branch information
aytey committed Apr 21, 2021
1 parent 28abb1f commit dc24686
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion alacritty_terminal/src/term/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,8 @@ impl<T> Term<T> {

if cols.end >= self.columns() - 1
&& (line_length.0 == 0
|| !self.grid[line][line_length - 1].flags.contains(Flags::WRAPLINE))
/* || !self.grid[line][line_length - 1].flags.contains(Flags::WRAPLINE)) */
|| self.grid[line][cols.end].c == ' ')
{
text.push('\n');
}
Expand Down

0 comments on commit dc24686

Please sign in to comment.