mirror of
https://github.com/wez/wezterm.git
synced 2024-12-23 21:32:13 +03:00
Fix SU
(scroll up) using default-blank cells
closes: https://github.com/wez/wezterm/issues/1102#
This commit is contained in:
parent
dc1996ac67
commit
311bd78902
@ -28,9 +28,10 @@ As features stabilize some brief notes about them will accumulate here.
|
||||
* Fixed: ALT + Arrow, PageUp/PageDown, Ins, Del, Home, End incorrectly sent ESC prefixed key sequences. [#892](https://github.com/wez/wezterm/issues/892)
|
||||
* New: Added [SendKey](config/lua/keyassignment/SendKey.md) key assignment action that makes it more convenient to rebind the key input that is sent to a pane.
|
||||
* Fixed: Crash due to Out of Memory condition when the iTerm2 protocol was used to send excessively large PNG files [#1031](https://github.com/wez/wezterm/issues/1031)
|
||||
* Fixed: `DCH` sequence would remove cells and replace them with default-blank cells instead of blank-cells-with-current-bg-color. [#789](https://github.com/wez/wezterm/issues/789)
|
||||
* Fixed: `DCH` (delete char) sequence would remove cells and replace them with default-blank cells instead of blank-cells-with-current-bg-color. [#789](https://github.com/wez/wezterm/issues/789)
|
||||
* New: Added [Multiple](config/lua/keyassignment/Multiple.md) key assignment action for combining multuple actions in a single press.
|
||||
* Fixed: invisible I-beam or underline cursor when `force_reverse_video_cursor = true` [#1076](https://github.com/wez/wezterm/issues/1076)
|
||||
* Fixed: `SU` (scroll up) sequence would fill with default-blank cells instead of blank-cells-with-current-bg-color. [#1102](https://github.com/wez/wezterm/issues/1102)
|
||||
|
||||
### 20210814-124438-54e29167
|
||||
|
||||
|
@ -456,6 +456,7 @@ impl Screen {
|
||||
left_and_right_margins: &Range<usize>,
|
||||
num_rows: usize,
|
||||
seqno: SequenceNo,
|
||||
blank_attr: CellAttributes,
|
||||
) {
|
||||
log::debug!(
|
||||
"scroll_up_within_margins region:{:?} margins:{:?} rows={}",
|
||||
@ -465,7 +466,7 @@ impl Screen {
|
||||
);
|
||||
|
||||
if left_and_right_margins.start == 0 && left_and_right_margins.end == self.physical_cols {
|
||||
return self.scroll_up(scroll_region, num_rows, seqno);
|
||||
return self.scroll_up(scroll_region, num_rows, seqno, blank_attr);
|
||||
}
|
||||
|
||||
// Need to do the slower, more complex left and right bounded scroll
|
||||
@ -509,7 +510,11 @@ impl Screen {
|
||||
*dest_cell = src_cell.clone();
|
||||
}
|
||||
|
||||
dest_row.fill_range(tail_range, &Cell::blank(), seqno);
|
||||
dest_row.fill_range(
|
||||
tail_range,
|
||||
&Cell::blank_with_attrs(blank_attr.clone()),
|
||||
seqno,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -524,7 +529,7 @@ impl Screen {
|
||||
.skip(left_and_right_margins.start)
|
||||
.take(left_and_right_margins.end - left_and_right_margins.start)
|
||||
{
|
||||
*cell = Cell::blank();
|
||||
*cell = Cell::blank_with_attrs(blank_attr.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -548,6 +553,7 @@ impl Screen {
|
||||
scroll_region: &Range<VisibleRowIndex>,
|
||||
num_rows: usize,
|
||||
seqno: SequenceNo,
|
||||
blank_attr: CellAttributes,
|
||||
) {
|
||||
let phys_scroll = self.phys_range(scroll_region);
|
||||
let num_rows = num_rows.min(phys_scroll.end - phys_scroll.start);
|
||||
@ -596,7 +602,7 @@ impl Screen {
|
||||
for _ in 0..to_move {
|
||||
let mut line = self.lines.remove(remove_idx).unwrap();
|
||||
// Make the line like a new one of the appropriate width
|
||||
line.resize_and_clear(self.physical_cols, seqno);
|
||||
line.resize_and_clear(self.physical_cols, seqno, blank_attr.clone());
|
||||
line.update_last_change_seqno(seqno);
|
||||
if scroll_region.end as usize == self.physical_rows {
|
||||
self.lines.push_back(line);
|
||||
@ -621,12 +627,20 @@ impl Screen {
|
||||
if scroll_region.end as usize == self.physical_rows {
|
||||
// It's cheaper to push() than it is insert() at the end
|
||||
for _ in 0..to_add {
|
||||
self.lines.push_back(Line::with_width(self.physical_cols));
|
||||
self.lines.push_back(Line::with_width_and_cell(
|
||||
self.physical_cols,
|
||||
Cell::blank_with_attrs(blank_attr.clone()),
|
||||
));
|
||||
}
|
||||
} else {
|
||||
for _ in 0..to_add {
|
||||
self.lines
|
||||
.insert(phys_scroll.end, Line::with_width(self.physical_cols));
|
||||
self.lines.insert(
|
||||
phys_scroll.end,
|
||||
Line::with_width_and_cell(
|
||||
self.physical_cols,
|
||||
Cell::blank_with_attrs(blank_attr.clone()),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -657,6 +671,7 @@ impl Screen {
|
||||
scroll_region: &Range<VisibleRowIndex>,
|
||||
num_rows: usize,
|
||||
seqno: SequenceNo,
|
||||
blank_attr: CellAttributes,
|
||||
) {
|
||||
debug!("scroll_down {:?} {}", scroll_region, num_rows);
|
||||
let phys_scroll = self.phys_range(scroll_region);
|
||||
@ -674,8 +689,13 @@ impl Screen {
|
||||
}
|
||||
|
||||
for _ in 0..num_rows {
|
||||
self.lines
|
||||
.insert(phys_scroll.start, Line::with_width(self.physical_cols));
|
||||
self.lines.insert(
|
||||
phys_scroll.start,
|
||||
Line::with_width_and_cell(
|
||||
self.physical_cols,
|
||||
Cell::blank_with_attrs(blank_attr.clone()),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -685,9 +705,10 @@ impl Screen {
|
||||
left_and_right_margins: &Range<usize>,
|
||||
num_rows: usize,
|
||||
seqno: SequenceNo,
|
||||
blank_attr: CellAttributes,
|
||||
) {
|
||||
if left_and_right_margins.start == 0 && left_and_right_margins.end == self.physical_cols {
|
||||
return self.scroll_down(scroll_region, num_rows, seqno);
|
||||
return self.scroll_down(scroll_region, num_rows, seqno, blank_attr);
|
||||
}
|
||||
|
||||
// Need to do the slower, more complex left and right bounded scroll
|
||||
@ -730,7 +751,11 @@ impl Screen {
|
||||
*dest_cell = src_cell.clone();
|
||||
}
|
||||
|
||||
dest_row.fill_range(tail_range, &Cell::default(), seqno);
|
||||
dest_row.fill_range(
|
||||
tail_range,
|
||||
&Cell::blank_with_attrs(blank_attr.clone()),
|
||||
seqno,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -745,7 +770,7 @@ impl Screen {
|
||||
.skip(left_and_right_margins.start)
|
||||
.take(left_and_right_margins.end - left_and_right_margins.start)
|
||||
{
|
||||
*cell = Cell::default();
|
||||
*cell = Cell::blank_with_attrs(blank_attr.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -813,6 +813,7 @@ impl TerminalState {
|
||||
|
||||
fn scroll_up(&mut self, num_rows: usize) {
|
||||
let seqno = self.seqno;
|
||||
let blank_attr = self.pen.clone_sgr_only();
|
||||
let top_and_bottom_margins = self.top_and_bottom_margins.clone();
|
||||
let left_and_right_margins = self.left_and_right_margins.clone();
|
||||
self.screen_mut().scroll_up_within_margins(
|
||||
@ -820,11 +821,13 @@ impl TerminalState {
|
||||
&left_and_right_margins,
|
||||
num_rows,
|
||||
seqno,
|
||||
blank_attr,
|
||||
)
|
||||
}
|
||||
|
||||
fn scroll_down(&mut self, num_rows: usize) {
|
||||
let seqno = self.seqno;
|
||||
let blank_attr = self.pen.clone_sgr_only();
|
||||
let top_and_bottom_margins = self.top_and_bottom_margins.clone();
|
||||
let left_and_right_margins = self.left_and_right_margins.clone();
|
||||
self.screen_mut().scroll_down_within_margins(
|
||||
@ -832,6 +835,7 @@ impl TerminalState {
|
||||
&left_and_right_margins,
|
||||
num_rows,
|
||||
seqno,
|
||||
blank_attr,
|
||||
)
|
||||
}
|
||||
|
||||
@ -1721,11 +1725,13 @@ impl TerminalState {
|
||||
{
|
||||
let top_and_bottom_margins = self.cursor.y..self.top_and_bottom_margins.end;
|
||||
let left_and_right_margins = self.left_and_right_margins.clone();
|
||||
let blank_attr = self.pen.clone_sgr_only();
|
||||
self.screen_mut().scroll_up_within_margins(
|
||||
&top_and_bottom_margins,
|
||||
&left_and_right_margins,
|
||||
n as usize,
|
||||
seqno,
|
||||
blank_attr,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1780,11 +1786,13 @@ impl TerminalState {
|
||||
{
|
||||
let top_and_bottom_margins = self.cursor.y..self.top_and_bottom_margins.end;
|
||||
let left_and_right_margins = self.left_and_right_margins.clone();
|
||||
let blank_attr = self.pen.clone_sgr_only();
|
||||
self.screen_mut().scroll_down_within_margins(
|
||||
&top_and_bottom_margins,
|
||||
&left_and_right_margins,
|
||||
n as usize,
|
||||
seqno,
|
||||
blank_attr,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -60,6 +60,17 @@ pub enum DoubleClickRange {
|
||||
}
|
||||
|
||||
impl Line {
|
||||
pub fn with_width_and_cell(width: usize, cell: Cell) -> Self {
|
||||
let mut cells = Vec::with_capacity(width);
|
||||
cells.resize(width, cell.clone());
|
||||
let bits = LineBits::NONE;
|
||||
Self {
|
||||
bits,
|
||||
cells,
|
||||
seqno: SEQ_ZERO,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_width(width: usize) -> Self {
|
||||
let mut cells = Vec::with_capacity(width);
|
||||
cells.resize_with(width, Cell::blank);
|
||||
@ -98,11 +109,17 @@ impl Line {
|
||||
line
|
||||
}
|
||||
|
||||
pub fn resize_and_clear(&mut self, width: usize, seqno: SequenceNo) {
|
||||
pub fn resize_and_clear(
|
||||
&mut self,
|
||||
width: usize,
|
||||
seqno: SequenceNo,
|
||||
blank_attr: CellAttributes,
|
||||
) {
|
||||
for c in &mut self.cells {
|
||||
*c = Cell::blank();
|
||||
*c = Cell::blank_with_attrs(blank_attr.clone());
|
||||
}
|
||||
self.cells.resize_with(width, Cell::blank);
|
||||
self.cells
|
||||
.resize_with(width, || Cell::blank_with_attrs(blank_attr.clone()));
|
||||
self.cells.shrink_to_fit();
|
||||
self.update_last_change_seqno(seqno);
|
||||
self.bits = LineBits::NONE;
|
||||
@ -561,7 +578,7 @@ impl Line {
|
||||
}
|
||||
|
||||
pub fn prune_trailing_blanks(&mut self, seqno: SequenceNo) {
|
||||
let def_attr = CellAttributes::default();
|
||||
let def_attr = CellAttributes::blank();
|
||||
if let Some(end_idx) = self
|
||||
.cells
|
||||
.iter()
|
||||
|
@ -259,7 +259,7 @@ impl RenderableInner {
|
||||
}
|
||||
} else {
|
||||
// The pasted line replaces the data for the existing line
|
||||
line.resize_and_clear(0, SEQ_ZERO);
|
||||
line.resize_and_clear(0, SEQ_ZERO, CellAttributes::default());
|
||||
line.append_line(text_line, SEQ_ZERO);
|
||||
self.cursor_position.x = line.cells().len();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user