terminal: horizontal tab
parent
ccd821a0ff
commit
b5da54d925
|
|
@ -33,7 +33,8 @@ pub const Action = union(Key) {
|
||||||
print: Print,
|
print: Print,
|
||||||
bell,
|
bell,
|
||||||
backspace,
|
backspace,
|
||||||
horizontal_tab: HorizontalTab,
|
horizontal_tab: u16,
|
||||||
|
horizontal_tab_back: u16,
|
||||||
linefeed,
|
linefeed,
|
||||||
carriage_return,
|
carriage_return,
|
||||||
enquiry,
|
enquiry,
|
||||||
|
|
@ -55,6 +56,7 @@ pub const Action = union(Key) {
|
||||||
"bell",
|
"bell",
|
||||||
"backspace",
|
"backspace",
|
||||||
"horizontal_tab",
|
"horizontal_tab",
|
||||||
|
"horizontal_tab_back",
|
||||||
"linefeed",
|
"linefeed",
|
||||||
"carriage_return",
|
"carriage_return",
|
||||||
"enquiry",
|
"enquiry",
|
||||||
|
|
@ -98,10 +100,6 @@ pub const Action = union(Key) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const HorizontalTab = lib.Struct(lib_target, struct {
|
|
||||||
count: u16,
|
|
||||||
});
|
|
||||||
|
|
||||||
pub const InvokeCharset = lib.Struct(lib_target, struct {
|
pub const InvokeCharset = lib.Struct(lib_target, struct {
|
||||||
bank: charsets.ActiveSlot,
|
bank: charsets.ActiveSlot,
|
||||||
charset: charsets.Slots,
|
charset: charsets.Slots,
|
||||||
|
|
@ -446,7 +444,7 @@ pub fn Stream(comptime Handler: type) type {
|
||||||
.ENQ => try self.handler.vt(.enquiry, {}),
|
.ENQ => try self.handler.vt(.enquiry, {}),
|
||||||
.BEL => try self.handler.vt(.bell, {}),
|
.BEL => try self.handler.vt(.bell, {}),
|
||||||
.BS => try self.handler.vt(.backspace, {}),
|
.BS => try self.handler.vt(.backspace, {}),
|
||||||
.HT => try self.handler.vt(.horizontal_tab, .{ .count = 1 }),
|
.HT => try self.handler.vt(.horizontal_tab, 1),
|
||||||
.LF, .VT, .FF => try self.handler.vt(.linefeed, {}),
|
.LF, .VT, .FF => try self.handler.vt(.linefeed, {}),
|
||||||
.CR => try self.handler.vt(.carriage_return, {}),
|
.CR => try self.handler.vt(.carriage_return, {}),
|
||||||
.SO => try self.handler.vt(.invoke_charset, .{ .bank = .GL, .charset = .G1, .locking = false }),
|
.SO => try self.handler.vt(.invoke_charset, .{ .bank = .GL, .charset = .G1, .locking = false }),
|
||||||
|
|
@ -622,16 +620,14 @@ pub fn Stream(comptime Handler: type) type {
|
||||||
|
|
||||||
// CHT - Cursor Horizontal Tabulation
|
// CHT - Cursor Horizontal Tabulation
|
||||||
'I' => switch (input.intermediates.len) {
|
'I' => switch (input.intermediates.len) {
|
||||||
0 => if (@hasDecl(T, "horizontalTab")) try self.handler.horizontalTab(
|
0 => try self.handler.vt(.horizontal_tab, switch (input.params.len) {
|
||||||
switch (input.params.len) {
|
0 => 1,
|
||||||
0 => 1,
|
1 => input.params[0],
|
||||||
1 => input.params[0],
|
else => {
|
||||||
else => {
|
log.warn("invalid horizontal tab command: {f}", .{input});
|
||||||
log.warn("invalid horizontal tab command: {f}", .{input});
|
return;
|
||||||
return;
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
) else log.warn("unimplemented CSI callback: {f}", .{input}),
|
}),
|
||||||
|
|
||||||
else => log.warn(
|
else => log.warn(
|
||||||
"ignoring unimplemented CSI I with intermediates: {s}",
|
"ignoring unimplemented CSI I with intermediates: {s}",
|
||||||
|
|
@ -855,16 +851,14 @@ pub fn Stream(comptime Handler: type) type {
|
||||||
|
|
||||||
// CHT - Cursor Horizontal Tabulation Back
|
// CHT - Cursor Horizontal Tabulation Back
|
||||||
'Z' => switch (input.intermediates.len) {
|
'Z' => switch (input.intermediates.len) {
|
||||||
0 => if (@hasDecl(T, "horizontalTabBack")) try self.handler.horizontalTabBack(
|
0 => try self.handler.vt(.horizontal_tab_back, switch (input.params.len) {
|
||||||
switch (input.params.len) {
|
0 => 1,
|
||||||
0 => 1,
|
1 => input.params[0],
|
||||||
1 => input.params[0],
|
else => {
|
||||||
else => {
|
log.warn("invalid horizontal tab back command: {f}", .{input});
|
||||||
log.warn("invalid horizontal tab back command: {f}", .{input});
|
return;
|
||||||
return;
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
) else log.warn("unimplemented CSI callback: {f}", .{input}),
|
}),
|
||||||
|
|
||||||
else => log.warn(
|
else => log.warn(
|
||||||
"ignoring unimplemented CSI Z with intermediates: {s}",
|
"ignoring unimplemented CSI Z with intermediates: {s}",
|
||||||
|
|
|
||||||
|
|
@ -197,7 +197,8 @@ pub const StreamHandler = struct {
|
||||||
.print => try self.terminal.print(value.cp),
|
.print => try self.terminal.print(value.cp),
|
||||||
.bell => self.bell(),
|
.bell => self.bell(),
|
||||||
.backspace => self.terminal.backspace(),
|
.backspace => self.terminal.backspace(),
|
||||||
.horizontal_tab => try self.horizontalTab(value.count),
|
.horizontal_tab => try self.horizontalTab(value),
|
||||||
|
.horizontal_tab_back => try self.horizontalTabBack(value),
|
||||||
.linefeed => try self.linefeed(),
|
.linefeed => try self.linefeed(),
|
||||||
.carriage_return => self.terminal.carriageReturn(),
|
.carriage_return => self.terminal.carriageReturn(),
|
||||||
.enquiry => try self.enquiry(),
|
.enquiry => try self.enquiry(),
|
||||||
|
|
@ -372,7 +373,7 @@ pub const StreamHandler = struct {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub inline fn horizontalTabBack(self: *StreamHandler, count: u16) !void {
|
inline fn horizontalTabBack(self: *StreamHandler, count: u16) !void {
|
||||||
for (0..count) |_| {
|
for (0..count) |_| {
|
||||||
const x = self.terminal.screen.cursor.x;
|
const x = self.terminal.screen.cursor.x;
|
||||||
try self.terminal.horizontalTabBack();
|
try self.terminal.horizontalTabBack();
|
||||||
|
|
@ -386,8 +387,6 @@ pub const StreamHandler = struct {
|
||||||
try self.terminal.index();
|
try self.terminal.index();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pub inline fn eraseDisplay(self: *StreamHandler, mode: terminal.EraseDisplay, protected: bool) !void {
|
pub inline fn eraseDisplay(self: *StreamHandler, mode: terminal.EraseDisplay, protected: bool) !void {
|
||||||
if (mode == .complete) {
|
if (mode == .complete) {
|
||||||
// Whenever we erase the full display, scroll to bottom.
|
// Whenever we erase the full display, scroll to bottom.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue