~leon_plickat/public-inbox

zig-spoon: Add Term.setWindowTitle() v1 SUPERSEDED

Hugo Machet: 1
 Add Term.setWindowTitle()

 2 files changed, 7 insertions(+), 0 deletions(-)
#743927 alpine.yml success
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~leon_plickat/public-inbox/patches/31547/mbox | git am -3
Learn more about email & git

[PATCH zig-spoon] Add Term.setWindowTitle() Export this patch

---
Added it in the menu example to test

Unrelated but writing it, I saw in the function below, moveCursorTo(), that it use:

    _ = try writer.print()

Since print() return !void, is this an error?
 example/menu.zig | 1 +
 lib/Term.zig     | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/example/menu.zig b/example/menu.zig
index d34abef3bd18..d4410abcfa7a 100644
--- a/example/menu.zig
+++ b/example/menu.zig
@@ -33,6 +33,7 @@ pub fn main() !void {
    try term.hideCursor();

    try term.fetchSize();
    try term.setWindowTitle("nfm example - menu");
    try term.updateContent();

    var buf: [16]u8 = undefined;
diff --git a/lib/Term.zig b/lib/Term.zig
index 467df2024294..e7df6274a756 100644
--- a/lib/Term.zig
+++ b/lib/Term.zig
@@ -180,6 +180,12 @@ pub fn clear(self: *Self) !void {
    try writer.writeAll(spells.clear);
}

/// Set window title using OSC 2.
pub fn setWindowTitle(self: *Self, title: []const u8) !void {
    const writer = self.stdout.writer();
    try writer.print("\x1b]2;{s}\x1b\\", .{title});
}

/// Move the cursor to the specified cell.
pub fn moveCursorTo(self: *Self, row: usize, col: usize) !void {
    const writer = self.stdout.writer();
-- 
2.36.0
zig-spoon/patches/alpine.yml: SUCCESS in 32s

[Add Term.setWindowTitle()][0] from [Hugo Machet][1]

[0]: https://lists.sr.ht/~leon_plickat/public-inbox/patches/31547
[1]: mailto:mail@hmachet.com

✓ #743927 SUCCESS zig-spoon/patches/alpine.yml https://builds.sr.ht/~leon_plickat/job/743927
Thanks for working on this!

On Mon Apr 25, 2022 at 12:11 PM CEST, Hugo Machet wrote: