mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 00:36:07 +03:00
terminal: erase display below should unwrap soft wrapped state
This commit is contained in:
@ -1876,22 +1876,21 @@ pub fn resize(self: *Screen, rows: usize, cols: usize) !void {
|
||||
while (iter.next()) |old_row| {
|
||||
// If we're past the end, scroll
|
||||
if (y >= self.rows) {
|
||||
y -= 1;
|
||||
try self.scroll(.{ .delta = 1 });
|
||||
y -= 1;
|
||||
}
|
||||
|
||||
// Get this row
|
||||
var new_row = self.getRow(.{ .active = y });
|
||||
try new_row.copyRow(old_row);
|
||||
|
||||
// We need to check if our cursor was on this line. If so,
|
||||
// we set the new cursor.
|
||||
if (cursor_pos.y == iter.value - 1) {
|
||||
assert(new_cursor == null); // should only happen once
|
||||
new_cursor = .{ .y = self.rowsWritten() - 1, .x = cursor_pos.x };
|
||||
new_cursor = .{ .y = self.history + y, .x = cursor_pos.x };
|
||||
}
|
||||
|
||||
// If no reflow, just keep going.
|
||||
// At this point, we're always at x == 0 so we can just copy
|
||||
// the row (we know old.cols < self.cols).
|
||||
var new_row = self.getRow(.{ .active = y });
|
||||
try new_row.copyRow(old_row);
|
||||
if (!old_row.header().flags.wrap) {
|
||||
// If we have no reflow, we attempt to extend any stylized
|
||||
// cells at the end of the line if there is one.
|
||||
@ -1955,7 +1954,7 @@ pub fn resize(self: *Screen, rows: usize, cols: usize) !void {
|
||||
cursor_pos.x < copy_len and
|
||||
new_cursor == null)
|
||||
{
|
||||
new_cursor = .{ .y = self.rowsWritten() - 1, .x = x + cursor_pos.x };
|
||||
new_cursor = .{ .y = self.history + y, .x = x + cursor_pos.x };
|
||||
}
|
||||
|
||||
// We copied the full amount left in this wrapped row.
|
||||
|
@ -912,19 +912,26 @@ pub fn eraseDisplay(
|
||||
|
||||
.below => {
|
||||
// All lines to the right (including the cursor)
|
||||
var x: usize = self.screen.cursor.x;
|
||||
while (x < self.cols) : (x += 1) {
|
||||
const cell = self.screen.getCellPtr(.active, self.screen.cursor.y, x);
|
||||
cell.* = self.screen.cursor.pen;
|
||||
cell.char = 0;
|
||||
{
|
||||
const row = self.screen.getRow(.{ .active = self.screen.cursor.y });
|
||||
row.setWrapped(false);
|
||||
row.setDirty(true);
|
||||
for (self.screen.cursor.x..self.cols) |x| {
|
||||
if (row.header().flags.grapheme) row.clearGraphemes(x);
|
||||
const cell = row.getCellPtr(x);
|
||||
cell.* = self.screen.cursor.pen;
|
||||
cell.char = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// All lines below
|
||||
var y: usize = self.screen.cursor.y + 1;
|
||||
while (y < self.rows) : (y += 1) {
|
||||
x = 0;
|
||||
while (x < self.cols) : (x += 1) {
|
||||
const cell = self.screen.getCellPtr(.active, y, x);
|
||||
for ((self.screen.cursor.y + 1)..self.rows) |y| {
|
||||
const row = self.screen.getRow(.{ .active = y });
|
||||
row.setWrapped(false);
|
||||
row.setDirty(true);
|
||||
for (0..self.cols) |x| {
|
||||
if (row.header().flags.grapheme) row.clearGraphemes(x);
|
||||
const cell = row.getCellPtr(x);
|
||||
cell.* = self.screen.cursor.pen;
|
||||
cell.char = 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user