mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-19 06:38:44 +00:00
Lists: restartNumbering false in a threaded frame keeps the continued paragraph's number
When a threaded frame starts inside a numbered paragraph, restartNumbering false on that frame no longer takes away the number the paragraph has in the frame before.
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -863,7 +863,8 @@ fn a_given_number_carries_through_threaded_frames() {
|
||||
}
|
||||
|
||||
/// A number given in a threaded frame whose first paragraph continues from the frame before goes
|
||||
/// to the next numbered paragraph that begins in that frame, not to the item the earlier frame shows.
|
||||
/// to the next numbered paragraph that begins in that frame, not to the item the earlier frame shows,
|
||||
/// and `restartNumbering` false there leaves that item's number alone.
|
||||
#[test]
|
||||
fn a_given_number_skips_the_paragraph_continued_from_the_frame_before() {
|
||||
let mut s = Session::new();
|
||||
@@ -887,6 +888,11 @@ fn a_given_number_skips_the_paragraph_continued_from_the_frame_before() {
|
||||
assert_eq!((numbers(&s, a), numbers(&s, b)), (vec!["1.".to_string(), "2.".into()], vec!["3.".to_string()]));
|
||||
s.execute("text.setFormat", &json!({"ids": [b], "startNumber": 5})).unwrap();
|
||||
assert_eq!((numbers(&s, a), numbers(&s, b)), (vec!["1.".to_string(), "2.".into()], vec!["5.".to_string()]));
|
||||
// The long item, numbered in the first frame, keeps its number when the second frame's are taken away.
|
||||
s.execute("text.setFormat", &json!({"ids": [a], "start": 4, "end": 4, "startNumber": 8})).unwrap();
|
||||
assert_eq!((numbers(&s, a), numbers(&s, b)), (vec!["1.".to_string(), "8.".into()], vec!["5.".to_string()]));
|
||||
s.execute("text.setFormat", &json!({"ids": [b], "restartNumbering": false})).unwrap();
|
||||
assert_eq!((numbers(&s, a), numbers(&s, b)), (vec!["1.".to_string(), "8.".into()], vec!["9.".to_string()]));
|
||||
}
|
||||
|
||||
/// `startNumber` over several type objects goes to the first numbered paragraph with text among
|
||||
|
||||
+1
-1
@@ -10229,7 +10229,7 @@ order of `ids`. A threaded frame's first paragraph is passed over when it contin
|
||||
paragraph given the number shows it, and the numbered paragraphs after it at its level count on from it,
|
||||
through the frames of threaded type. Deeper levels count from 1 after it, as after any list paragraph, and a paragraph in
|
||||
no list still starts the count again. `restartNumbering: false` takes the number away from every paragraph the call
|
||||
touches, and they count on from the paragraph before. `startNumber` is a whole number (`5` or `5.0`); 0, a negative
|
||||
touches except such a continued first paragraph, and they count on from the paragraph before. `startNumber` is a whole number (`5` or `5.0`); 0, a negative
|
||||
number, a fraction, a number past 999999999 and any other type are errors, and giving both keys is an error. A call
|
||||
that touches no numbered paragraph, or that gives the number the paragraph already has, changes nothing and records no
|
||||
undo step. A call that also puts paragraphs in a numbered list gives the number after the list is set. Return in a
|
||||
|
||||
Reference in New Issue
Block a user