hook up setMode

This commit is contained in:
Mitchell Hashimoto
2022-05-11 10:07:33 -07:00
parent b2d02a77cd
commit df7e91a5e5
3 changed files with 19 additions and 0 deletions

View File

@ -564,3 +564,15 @@ pub fn eraseChars(self: *Window, count: usize) !void {
pub fn reverseIndex(self: *Window) !void { pub fn reverseIndex(self: *Window) !void {
try self.terminal.reverseIndex(self.alloc); try self.terminal.reverseIndex(self.alloc);
} }
pub fn setMode(self: *Window, mode: terminal.Mode, enabled: bool) !void {
switch (mode) {
.origin => {
self.terminal.mode_origin = enabled;
self.terminal.setCursorPos(1, 1);
unreachable; // TODO: implement
},
else => if (enabled) log.warn("unimplemented mode: {}", .{mode}),
}
}

View File

@ -31,6 +31,10 @@ cols: usize,
/// The current scrolling region. /// The current scrolling region.
scrolling_region: ScrollingRegion, scrolling_region: ScrollingRegion,
/// Modes
// TODO: turn into a bitset probably
mode_origin: bool = false,
/// Screen represents a presentable terminal screen made up of lines and cells. /// Screen represents a presentable terminal screen made up of lines and cells.
const Screen = std.ArrayListUnmanaged(Line); const Screen = std.ArrayListUnmanaged(Line);
const Line = std.ArrayListUnmanaged(Cell); const Line = std.ArrayListUnmanaged(Cell);

View File

@ -1,15 +1,18 @@
const stream = @import("stream.zig"); const stream = @import("stream.zig");
const ansi = @import("ansi.zig");
const csi = @import("csi.zig"); const csi = @import("csi.zig");
pub const Terminal = @import("Terminal.zig"); pub const Terminal = @import("Terminal.zig");
pub const Parser = @import("Parser.zig"); pub const Parser = @import("Parser.zig");
pub const Stream = stream.Stream; pub const Stream = stream.Stream;
pub const Mode = ansi.Mode;
pub const EraseDisplay = csi.EraseDisplay; pub const EraseDisplay = csi.EraseDisplay;
pub const EraseLine = csi.EraseLine; pub const EraseLine = csi.EraseLine;
// Not exported because they're just used for tests. // Not exported because they're just used for tests.
test { test {
_ = ansi;
_ = csi; _ = csi;
_ = stream; _ = stream;
_ = Parser; _ = Parser;