File tree Expand file tree Collapse file tree 3 files changed +43
-2
lines changed
Expand file tree Collapse file tree 3 files changed +43
-2
lines changed Original file line number Diff line number Diff line change 1- const std = @import ("std" );
2-
31const esc = "\x1B " ;
42const csi = esc ++ "[" ;
53
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ pub const cursor = @import("cursor.zig");
44pub const clear = @import ("clear.zig" );
55pub const style = @import ("style.zig" );
66pub const format = @import ("format.zig" );
7+ pub const terminal = @import ("terminal.zig" );
78
89test {
910 std .testing .refAllDeclsRecursive (@This ());
Original file line number Diff line number Diff line change 1+ const esc = "\x1B " ;
2+ const csi = esc ++ "[" ;
3+
4+ pub fn disableLineWrap (writer : anytype ) ! void {
5+ try writer .writeAll (csi ++ "?7l" );
6+ }
7+
8+ pub fn enableLineWrap (writer : anytype ) ! void {
9+ try writer .writeAll (csi ++ "?7h" );
10+ }
11+
12+ pub fn saveScreen (writer : anytype ) ! void {
13+ try writer .writeAll (csi ++ "?47h" );
14+ }
15+
16+ pub fn restoreScreen (writer : anytype ) ! void {
17+ try writer .writeAll (csi ++ "?47l" );
18+ }
19+
20+ pub fn enterAlternateScreen (writer : anytype ) ! void {
21+ try writer .writeAll (csi ++ "?1049h" );
22+ }
23+
24+ pub fn leaveAlternateScreen (writer : anytype ) ! void {
25+ try writer .writeAll (csi ++ "?1049l" );
26+ }
27+
28+ pub fn setSize (writer : anytype , columns : u16 , rows : u16 ) ! void {
29+ try writer .print (csi ++ "8;{d};{d}t" , .{ rows , columns });
30+ }
31+
32+ pub fn setTitle (writer : anytype , title : []const u8 ) ! void {
33+ try writer .print (esc ++ "]0;{s}\x07 " , .{title });
34+ }
35+
36+ pub fn beginSynchronizedUpdate (writer : anytype ) ! void {
37+ try writer .writeAll (csi ++ "?2026h" );
38+ }
39+
40+ pub fn endSynchronizedUpdate (writer : anytype ) ! void {
41+ try writer .writeAll (csi ++ "?2026l" );
42+ }
You can’t perform that action at this time.
0 commit comments