mirror of
https://github.com/fairyglade/ly.git
synced 2025-12-20 19:24:53 +00:00
Format code properly
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
15
src/main.zig
15
src/main.zig
@@ -482,16 +482,15 @@ pub fn main() !void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (config.bigclock != .none and buffer.box_height + (bigclock.HEIGHT + 2) * 2 < buffer.height) {
|
if (config.bigclock != .none and buffer.box_height + (bigclock.HEIGHT + 2) * 2 < buffer.height) {
|
||||||
var format_buf: [16:0]u8 = undefined;
|
var format_buf: [16:0]u8 = undefined;
|
||||||
var clock_buf: [32:0]u8 = undefined;
|
var clock_buf: [32:0]u8 = undefined;
|
||||||
// We need the slice/c-string returned by `bufPrintZ`.
|
// We need the slice/c-string returned by `bufPrintZ`.
|
||||||
const format: [:0]const u8 = try std.fmt.bufPrintZ(&format_buf, "{s}{s}{s}{s}",
|
const format: [:0]const u8 = try std.fmt.bufPrintZ(&format_buf, "{s}{s}{s}{s}", .{
|
||||||
.{
|
if (config.bigclock_12hr) "%I" else "%H",
|
||||||
if (config.bigclock_12hr) "%I" else "%H",
|
":%M",
|
||||||
":%M",
|
if (config.bigclock_seconds) ":%S" else "",
|
||||||
if (config.bigclock_seconds) ":%S" else "",
|
if (config.bigclock_12hr) "%P" else "",
|
||||||
if (config.bigclock_12hr) "%P" else ""
|
});
|
||||||
});
|
|
||||||
const xo = buffer.width / 2 - @min(buffer.width, (format.len * (bigclock.WIDTH + 1))) / 2;
|
const xo = buffer.width / 2 - @min(buffer.width, (format.len * (bigclock.WIDTH + 1))) / 2;
|
||||||
const yo = (buffer.height - buffer.box_height) / 2 - bigclock.HEIGHT - 2;
|
const yo = (buffer.height - buffer.box_height) / 2 - bigclock.HEIGHT - 2;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user