deal with zero case in fixed scheme

This commit is contained in:
Samuel Ireson 2025-06-03 15:42:22 +01:00
parent 763fdc44d5
commit 29cc4a23e7

View File

@ -640,16 +640,16 @@ impl NumberingKind {
), ),
Self::CircledNumber => fixed( Self::CircledNumber => fixed(
[ [
'①', '②', '③', '④', '⑤', '⑥', '⑦', '⑧', '⑨', '⑩', '⑪', '⑫', '⑬', '⑭', '⓪', '①', '②', '③', '④', '⑤', '⑥', '⑦', '⑧', '⑨', '⑩', '⑪', '⑫', '⑬',
'⑮', '⑯', '⑰', '⑱', '⑲', '⑳', '㉑', '㉒', '㉓', '㉔', '㉕', '㉖', '⑭', '⑮', '⑯', '⑰', '⑱', '⑲', '⑳', '㉑', '㉒', '㉓', '㉔', '㉕',
'㉗', '㉘', '㉙', '㉚', '㉛', '㉜', '㉝', '㉞', '㉟', '㊱', '㊲', '㉖', '㉗', '㉘', '㉙', '㉚', '㉛', '㉜', '㉝', '㉞', '㉟', '㊱',
'㊳', '㊴', '㊵', '㊶', '㊷', '㊸', '㊹', '㊺', '㊻', '㊼', '㊽', '㊲', '㊳', '㊴', '㊵', '㊶', '㊷', '㊸', '㊹', '㊺', '㊻', '㊼',
'㊾', '㊿', '㊽', '㊾', '㊿',
], ],
n, n,
), ),
Self::DoubleCircledNumber => { Self::DoubleCircledNumber => {
fixed(['⓵', '⓶', '⓷', '⓸', '⓹', '⓺', '⓻', '⓼', '⓽', '⓾'], n) fixed(['0', '⓵', '⓶', '⓷', '⓸', '⓹', '⓺', '⓻', '⓼', '⓽', '⓾'], n)
} }
Self::LowerSimplifiedChinese => { Self::LowerSimplifiedChinese => {
@ -777,8 +777,8 @@ fn alphabetic<const N_DIGITS: usize>(symbols: [char; N_DIGITS], mut n: u64) -> E
/// ``` /// ```
fn fixed<const N_DIGITS: usize>(symbols: [char; N_DIGITS], n: u64) -> EcoString { fn fixed<const N_DIGITS: usize>(symbols: [char; N_DIGITS], n: u64) -> EcoString {
let n_digits = N_DIGITS as u64; let n_digits = N_DIGITS as u64;
if n - 1 < n_digits { if n < n_digits {
return symbols[(n - 1) as usize].into(); return symbols[(n) as usize].into();
} }
eco_format!("{n}") eco_format!("{n}")
} }