a lot
This commit is contained in:
parent
5e7c8bdae7
commit
9f0c0d4afb
2 changed files with 67 additions and 10 deletions
62
src/main.zig
62
src/main.zig
|
@ -14,17 +14,16 @@ pub fn main() !void {
|
|||
var term = try Terminal.init(allocator);
|
||||
defer term.deinit();
|
||||
|
||||
// var info = try Terminal.Info.init(allocator);
|
||||
// defer info.deinit();
|
||||
|
||||
// var seq = Terminal.Info.Sequence.init(allocator, &info);
|
||||
// defer seq.deinit();
|
||||
// try seq.cursorLeft();
|
||||
try term.print("poopoo", .{});
|
||||
try term.cursorLeft();
|
||||
try term.cursorLeft();
|
||||
try term.print("ee", .{});
|
||||
// try seq.writeOut(term.tty.writer()); //io.AnyWriter{ .context = &term.tty, .writeFn = &fs.File.write });
|
||||
// try term.cursorSet(12, 3);
|
||||
try term.boldOn();
|
||||
try term.underlineOn();
|
||||
try term.print("AAAAAAAAAAAAAAAAAAA", .{});
|
||||
try term.boldOff();
|
||||
try term.underlineOff();
|
||||
}
|
||||
|
||||
pub const Terminal = struct {
|
||||
|
@ -87,9 +86,56 @@ pub const Terminal = struct {
|
|||
try self.tty.writeAll(formatted);
|
||||
}
|
||||
|
||||
pub fn cursorUp(self: *Terminal) !void {
|
||||
try self.info.writeString(.cursor_up, self.tty.writer(), &[_]u32{});
|
||||
}
|
||||
|
||||
pub fn cursorDown(self: *Terminal) !void {
|
||||
try self.info.writeString(.cursor_down, self.tty.writer(), &[_]u32{});
|
||||
}
|
||||
|
||||
pub fn cursorLeft(self: *Terminal) !void {
|
||||
try self.info.writeString(.cursor_left, self.tty.writer(), &[_]u32{});
|
||||
// try self.info.cursorLeft(self.tty.writer());
|
||||
}
|
||||
|
||||
pub fn cursorRight(self: *Terminal) !void {
|
||||
try self.info.writeString(.cursor_right, self.tty.writer(), &[_]u32{});
|
||||
}
|
||||
|
||||
pub fn cursorSet(self: *Terminal, x: u32, y: u32) !void {
|
||||
try self.info.writeString(.cursor_address, self.tty.writer(), &[_]u32{ y, x });
|
||||
}
|
||||
|
||||
pub fn blinkOn(self: *Terminal) !void {
|
||||
try self.info.writeString(.enter_blink_mode, self.tty.writer(), &[_]u32{});
|
||||
}
|
||||
|
||||
pub fn blinkOff(self: *Terminal) !void {
|
||||
try self.info.writeString(.exit_blink_mode, self.tty.writer(), &[_]u32{});
|
||||
}
|
||||
|
||||
pub fn boldOn(self: *Terminal) !void {
|
||||
try self.info.writeString(.enter_bold_mode, self.tty.writer(), &[_]u32{});
|
||||
}
|
||||
|
||||
pub fn boldOff(self: *Terminal) !void {
|
||||
try self.info.writeString(.exit_bold_mode, self.tty.writer(), &[_]u32{});
|
||||
}
|
||||
|
||||
pub fn italicsOn(self: *Terminal) !void {
|
||||
try self.info.writeString(.enter_italics_mode, self.tty.writer(), &[_]u32{});
|
||||
}
|
||||
|
||||
pub fn italicsOff(self: *Terminal) !void {
|
||||
try self.info.writeString(.exit_italics_mode, self.tty.writer(), &[_]u32{});
|
||||
}
|
||||
|
||||
pub fn underlineOn(self: *Terminal) !void {
|
||||
try self.info.writeString(.enter_underline_mode, self.tty.writer(), &[_]u32{});
|
||||
}
|
||||
|
||||
pub fn underlineOff(self: *Terminal) !void {
|
||||
try self.info.writeString(.exit_underline_mode, self.tty.writer(), &[_]u32{});
|
||||
}
|
||||
|
||||
pub const Info = @import("terminfo.zig");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue