M4: bulleted lists keep the same bullet at every level of indentation (#1843)

* M4: bulleted lists keep the same bullet at every level of indentation

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* list_markers: the comment says bullets are the same at every level

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
This commit is contained in:
Trevor Brown
2026-11-02 00:01:29 -05:00
committed by GitHub
co-authored by Claude Fable 5.1 Brandon Thomas
parent 9c3ec8c1d1
commit 8174dd5b74
3 changed files with 10 additions and 6 deletions
+6 -3
View File
@@ -1165,9 +1165,12 @@ pub fn layout(text: &TextData, box_width: Option<f64>, box_height: Option<f64>)
/// The markers of a text's paragraphs ("" for plain ones). Numbers count the items of one list at
/// one level, restarting after a plain paragraph, a shallower item or the other kind of list,
/// from the first item's start number; levels go 1. a. i. and • ◦ ▪, then round again.
/// from the first item's start number; levels go 1. a. i., then round again; bullets are • at
/// every level.
pub(crate) fn list_markers(lists: &[ParaList]) -> Vec<String> {
const BULLETS: [&str; 3] = ["\u{2022}", "\u{25E6}", "\u{25AA}"];
// "Figma bullets will keep the same styling at all levels of indentation." (Create bulleted
// and numbered lists)
const BULLET: &str = "\u{2022}";
let mut count = [(ListStyle::None, 0usize); figcraft_doc::MAX_LIST_INDENT as usize + 1];
lists
.iter()
@@ -1187,7 +1190,7 @@ pub(crate) fn list_markers(lists: &[ParaList]) -> Vec<String> {
(ListStyle::Numbered, 1) => format!("{}.", alpha(c.1)),
(ListStyle::Numbered, 2) => format!("{}.", roman(c.1)),
(ListStyle::Numbered, _) => format!("{}.", c.1),
_ => BULLETS.get(d % 3).copied().unwrap_or("\u{2022}").to_string(),
_ => BULLET.to_string(),
}
})
.collect()
+2 -2
View File
@@ -90,8 +90,8 @@ fn list_numbering_by_level() {
),
(
vec![pl(B, 0), pl(B, 1), pl(B, 2), pl(B, 3)],
vec!["\u{2022}", "\u{25E6}", "\u{25AA}", "\u{2022}"],
"silent: bullets change shape per level, round again",
vec!["\u{2022}", "\u{2022}", "\u{2022}", "\u{2022}"],
"bullets keep the same styling at all levels of indentation",
),
(vec![pl(N, 0), pl(N, 0), pl(P, 0), pl(N, 0)], vec!["1.", "2.", "", "1."], "silent: a plain paragraph ends a list, the next starts at 1"),
(vec![pl(N, 0), pl(B, 0), pl(N, 0)], vec!["1.", "\u{2022}", "1."], "silent: the other kind of list at the same level starts the count again"),
File diff suppressed because one or more lines are too long