feat: add status bar widget parameter support with parameters for linenumber and spacer widgets

linenumber widgets may have three parameters: pad width (int), pad value (space/zero) and
digit style (ascii/digital/subscript/superscript). eg `5,zero,digital`

spacers may have one parameter: width (int)
This commit is contained in:
CJ van den Berg 2025-03-25 20:50:11 +01:00
parent 0e72a714dc
commit aa568dfd5e
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
14 changed files with 80 additions and 18 deletions

View file

@ -242,6 +242,12 @@ pub fn get_digit(n: anytype, style_: DigitStyle) []const u8 {
};
}
pub fn get_digit_ascii(char: []const u8, style_: DigitStyle) []const u8 {
if (char.len == 0) return " ";
if (char[0] > '9' or char[0] < '0') return char;
return get_digit(char[0] - '0', style_);
}
const digits_ascii: [10][]const u8 = .{ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
const digits_digtl: [10][]const u8 = .{ "🯰", "🯱", "🯲", "🯳", "🯴", "🯵", "🯶", "🯷", "🯸", "🯹" };
const digits_subsc: [10][]const u8 = .{ "", "", "", "", "", "", "", "", "", "" };