Skip to content

Commit

Permalink
Ensure last action's documentation is properly generated
Browse files Browse the repository at this point in the history
The issue was caused by the documentation generation logic not writing the final buffered content.
  • Loading branch information
liby committed Jan 12, 2025
1 parent 368efc6 commit ea6ef37
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/build/webgen/main_actions.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
6 changes: 3 additions & 3 deletions src/input/Binding.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ea6ef37

Please sign in to comment.