summaryrefslogtreecommitdiff
path: root/main.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-06-16 23:04:59 -0300
committerGabriel Schneider <[email protected]>2026-06-25 11:23:20 -0300
commit6833b39ffe311f0f1e39b6669b946d712d7dcd93 (patch)
tree135a1016e1d9a957e73a92087d8e4afbadb79033 /main.zig
parent7e3240817c888ec3fa4c553cd77695e8d106598f (diff)
downloadpardes-6833b39ffe311f0f1e39b6669b946d712d7dcd93.tar.gz
pardes-6833b39ffe311f0f1e39b6669b946d712d7dcd93.zip
ghostty setup
Diffstat (limited to 'main.zig')
-rw-r--r--main.zig49
1 files changed, 26 insertions, 23 deletions
diff --git a/main.zig b/main.zig
index e591b7d0..a55ad637 100644
--- a/main.zig
+++ b/main.zig
@@ -1,5 +1,6 @@
const std = @import("std");
const vaxis = @import("vaxis");
+const ghostty_vt = @import("ghostty-vt");
// basic file navigation
// basic shell io
@@ -40,6 +41,15 @@ pub fn main(init: std.process.Init) !void {
const io = init.io;
const gpa = init.gpa;
+ var t: ghostty_vt.Terminal = try .init(gpa, .{
+ .cols = 6,
+ .rows = 40,
+ });
+ defer t.deinit(gpa);
+
+ try t.printString("hello there!\nhowdy!");
+ const str = try t.plainString(gpa);
+
var tty_buf: [0x10000]u8 = undefined;
var lines: [0x1000][0x1000]u8 = undefined;
@@ -78,17 +88,8 @@ pub fn main(init: std.process.Init) !void {
while (true) {
const event = try loop.nextEvent();
const win = vx.window();
-
- for (0..MAX_FILES) |i| {
- if (i > MAX_FILES) break;
-
- // const str: [:0]u8 = std.mem.absorbSentinel(&line);
- const len = std.mem.findSentinel(u8, 0, @ptrCast(&lines[i]));
- _ = win.printSegment(.{ .text = lines[i][0..len] }, .{
- .row_offset = @intCast(i),
- .wrap = .none,
- });
- }
+ const win_child = win.child(.{ .border = .{ .where = .all }, .height = 8, .width = 42 });
+ _ = win_child.printSegment(.{ .text = "hey" }, .{});
switch (event) {
.key_press => |key| {
@@ -97,20 +98,22 @@ pub fn main(init: std.process.Init) !void {
}
},
.mouse => |m| {
+ _ = win.printSegment(.{ .text = str }, .{ .col_offset = 1, .row_offset = 1 });
+
if (m.type == .press) {
// const txt = try std.fmt.allocPrint(gpa, "col={} row={} xo={} yo={}", .{ m.col, m.row, m.xoffset, m.yoffset });
- const len = std.mem.findSentinel(u8, 0, @ptrCast(&lines[@intCast(m.row)]));
- _ = win.printSegment(
- .{
- .text = lines[@intCast(m.row)][0..len],
- .style = .{ .fg = .{ .rgb = .{ 0x00, 0xd0, 0xaa } } },
- },
- .{
- .col_offset = @as(u16, @intCast(m.col)),
- .row_offset = @as(u16, @intCast(m.row)),
- .wrap = .none,
- },
- );
+ // constlen = std.mem.findSentinel(u8, 0, @ptrCast(&lines[@intCast(m.row)]));
+ // _ = win.printSegment(
+ // .{
+ // .text = lines[@intCast(m.row)][0..len],
+ // .style = .{ .fg = .{ .rgb = .{ 0x00, 0xd0, 0xaa } } },
+ // },
+ // .{
+ // .col_offset = @as(u16, @intCast(m.col)),
+ // .row_offset = @as(u16, @intCast(m.row)),
+ // .wrap = .none,
+ // },
+ // );
}
},
.winsize => |ws| try vx.resize(gpa, tty.writer(), ws),