mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
eraseline sets SGR on all cells
This commit is contained in:
@ -550,7 +550,7 @@ pub fn eraseDisplay(self: *Window, mode: terminal.EraseDisplay) !void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn eraseLine(self: *Window, mode: terminal.EraseLine) !void {
|
pub fn eraseLine(self: *Window, mode: terminal.EraseLine) !void {
|
||||||
try self.terminal.eraseLine(mode);
|
try self.terminal.eraseLine(self.alloc, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn deleteChars(self: *Window, count: usize) !void {
|
pub fn deleteChars(self: *Window, count: usize) !void {
|
||||||
|
@ -243,30 +243,26 @@ pub fn eraseDisplay(
|
|||||||
/// TODO: test
|
/// TODO: test
|
||||||
pub fn eraseLine(
|
pub fn eraseLine(
|
||||||
self: *Terminal,
|
self: *Terminal,
|
||||||
|
alloc: Allocator,
|
||||||
mode: csi.EraseLine,
|
mode: csi.EraseLine,
|
||||||
) !void {
|
) !void {
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
.right => {
|
.right => {
|
||||||
// If our cursor is outside our screen, we can't erase anything.
|
var x: usize = self.cursor.x;
|
||||||
if (self.cursor.y >= self.screen.items.len) return;
|
while (x < self.cols) : (x += 1) {
|
||||||
var line = &self.screen.items[self.cursor.y];
|
const cell = try self.getOrPutCell(alloc, x, self.cursor.y);
|
||||||
|
cell.* = self.cursor.pen;
|
||||||
// If our cursor is outside our screen, we can't erase anything.
|
|
||||||
if (self.cursor.x >= line.items.len) return;
|
|
||||||
|
|
||||||
for (line.items[self.cursor.x..line.items.len]) |*cell|
|
|
||||||
cell.char = 0;
|
cell.char = 0;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
.left => {
|
.left => {
|
||||||
// If our cursor is outside our screen, we can't erase anything.
|
var x: usize = self.cursor.x;
|
||||||
if (self.cursor.y >= self.screen.items.len) return;
|
while (x >= 0) : (x -= 1) {
|
||||||
var line = &self.screen.items[self.cursor.y];
|
const cell = try self.getOrPutCell(alloc, x, self.cursor.y);
|
||||||
|
cell.* = self.cursor.pen;
|
||||||
// Clear up to our cursor
|
|
||||||
const end = @minimum(line.items.len, self.cursor.x);
|
|
||||||
for (line.items[0..end]) |*cell|
|
|
||||||
cell.char = 0;
|
cell.char = 0;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
else => {
|
else => {
|
||||||
|
Reference in New Issue
Block a user