Ensure last action's documentation is properly generated

The issue was caused by the documentation generation logic not writing the final buffered content.
This commit is contained in:
Bryan Lee
2025-01-12 19:54:51 +08:00
parent 1b52365541
commit 05fe3e7ec3
2 changed files with 10 additions and 3 deletions

View File

@ -50,9 +50,16 @@ pub fn genKeybindActions(writer: anytype) !void {
'\n',
);
while (iter.next()) |s| {
// If it is the last line and empty, then skip it.
if (iter.peek() == null and s.len == 0) continue;
try buffer.appendSlice(s);
try buffer.appendSlice("\n");
}
}
}
// Write any remaining buffered documentation
if (buffer.items.len > 0) {
try writer.writeAll(buffer.items);
}
}

View File

@ -236,9 +236,9 @@ pub const Action = union(enum) {
/// Send an `ESC` sequence.
esc: []const u8,
// Send the given text. Uses Zig string literal syntax. This is currently
// not validated. If the text is invalid (i.e. contains an invalid escape
// sequence), the error will currently only show up in logs.
/// Send the given text. Uses Zig string literal syntax. This is currently
/// not validated. If the text is invalid (i.e. contains an invalid escape
/// sequence), the error will currently only show up in logs.
text: []const u8,
/// Send data to the pty depending on whether cursor key mode is enabled