mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 00:06:09 +03:00
more efficient eraseLines
This commit is contained in:
@ -648,7 +648,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(self.alloc, mode);
|
try self.terminal.eraseLine(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn deleteChars(self: *Window, count: usize) !void {
|
pub fn deleteChars(self: *Window, count: usize) !void {
|
||||||
|
@ -259,26 +259,17 @@ 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 => {
|
||||||
var x: usize = self.cursor.x;
|
const row = self.screen.getRow(self.cursor.y);
|
||||||
while (x < self.cols) : (x += 1) {
|
std.mem.set(Screen.Cell, row[self.cursor.x..], self.cursor.pen);
|
||||||
const cell = try self.getOrPutCell(alloc, x, self.cursor.y);
|
|
||||||
cell.* = self.cursor.pen;
|
|
||||||
cell.char = 0;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
.left => {
|
.left => {
|
||||||
var x: usize = self.cursor.x;
|
const row = self.screen.getRow(self.cursor.y);
|
||||||
while (x >= 0) : (x -= 1) {
|
std.mem.set(Screen.Cell, row[0..self.cursor.x], self.cursor.pen);
|
||||||
const cell = try self.getOrPutCell(alloc, x, self.cursor.y);
|
|
||||||
cell.* = self.cursor.pen;
|
|
||||||
cell.char = 0;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
else => {
|
else => {
|
||||||
|
@ -48,7 +48,7 @@ pub fn Stream(comptime Handler: type) type {
|
|||||||
//log.debug("char: {x}", .{c});
|
//log.debug("char: {x}", .{c});
|
||||||
const actions = self.parser.next(c);
|
const actions = self.parser.next(c);
|
||||||
for (actions) |action_opt| {
|
for (actions) |action_opt| {
|
||||||
// if (action_opt) |action| log.info("action: {}", .{action});
|
if (action_opt) |action| log.info("action: {}", .{action});
|
||||||
switch (action_opt orelse continue) {
|
switch (action_opt orelse continue) {
|
||||||
.print => |p| if (@hasDecl(T, "print")) try self.handler.print(p),
|
.print => |p| if (@hasDecl(T, "print")) try self.handler.print(p),
|
||||||
.execute => |code| try self.execute(code),
|
.execute => |code| try self.execute(code),
|
||||||
|
Reference in New Issue
Block a user