mirror of
https://mzte.de/git/LordMZTE/dotfiles.git
synced 2024-12-13 09:42:58 +01:00
improve writeFiglet function
This commit is contained in:
parent
debaff88c6
commit
fee780cff7
1 changed files with 10 additions and 10 deletions
|
@ -12,18 +12,18 @@ const figlet =
|
|||
|
||||
pub fn writeFiglet(writer: anytype) !void {
|
||||
var style: ?at.style.Style = null;
|
||||
var iter = std.mem.split(u8, figlet, "\n");
|
||||
while (iter.next()) |line| {
|
||||
for (line) |char| {
|
||||
if (char == 'r') {
|
||||
for (figlet) |char| {
|
||||
switch (char) {
|
||||
'r' => {
|
||||
try at.format.updateStyle(writer, .{ .foreground = .Red }, style);
|
||||
style = .{ .foreground = .Red };
|
||||
} else {
|
||||
try writer.writeByte(char);
|
||||
}
|
||||
},
|
||||
'\n' => {
|
||||
try at.format.updateStyle(writer, .{ .foreground = .Default }, style);
|
||||
style = .{ .foreground = .Default };
|
||||
try writer.writeByte('\n');
|
||||
},
|
||||
else => try writer.writeByte(char),
|
||||
}
|
||||
try at.format.updateStyle(writer, .{ .foreground = .Default }, style);
|
||||
style = .{ .foreground = .Default };
|
||||
try writer.writeByte('\n');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue