1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-23 06:54:45 +03:00

fix incorrect underline attribute when scrolling

Given this sequence:

ENABLE-UNDERLINE CRLF SGR-RESET

if the CRLF caused the terminal to scroll, the newly created line
at the bottom would be filled in with a "blank" cell that had
the underline attribute set.

That's because we're supposed to preserve the coloring in that
scenario, but we were also preserving other SGR attributes.

This commit explicitly clears out under, over and strikethrough
lines from these blank attributes.

refs: https://github.com/wez/wezterm/issues/2489
This commit is contained in:
Wez Furlong 2022-09-06 20:01:30 -07:00
parent d8e43b92b8
commit dbacf98b89
2 changed files with 17 additions and 0 deletions

View File

@ -16,6 +16,9 @@ As features stabilize some brief notes about them will accumulate here.
Thanks to [@unrelentingtech](https://github.com/unrelentingtech)!
[#2492](https://github.com/wez/wezterm/pull/2492)
[#2452](https://github.com/wez/wezterm/issues/2452)
* If the underline attribute was active and CRLF scrolled a new line into the
bottom of the display, we'd fill that new line with underlines.
[#2489](https://github.com/wez/wezterm/issues/2489)
### 20220905-102802-7d4b8249

View File

@ -483,6 +483,20 @@ impl CellAttributes {
// easier time in get_semantic_zones.
res.set_semantic_type(SemanticType::default());
res.set_underline_color(self.underline_color());
// Turn off underline because it can have surprising results
// if underline is on, then we get CRLF and then SGR reset:
// If the CRLF causes a line to scroll, we'll call clone_sgr_only()
// to get a blank cell for the new line and it would be filled
// with underlines.
// clone_sgr_only() is primarily for preserving the background
// color when erasing rather than other attributes, so it should
// be fine to clear out the actual underline attribute.
// Let's extend this to other line attribute types as well.
// <https://github.com/wez/wezterm/issues/2489>
res.set_underline(Underline::None);
res.set_overline(false);
res.set_strikethrough(false);
res
}