Compare commits

...
Author SHA1 Message Date
autocraft-bot[bot] d0cd86e378 Merge main (2f168645) into the pull request
Resolved the conflicts in docs/layout-parity.md and kept both sides. The

Resolved the conflicts in docs/layout-parity.md and kept both sides. The header status line is the default branch's with the pull request's #6577 entry added at the front of the change list. The history table now has both new rows. No conflict markers remain.
2026-12-02 21:16:22 +00:00
jayzed80 ec29711caf Merge branch 'agyreview/6628' into HEAD
# Conflicts:
#	docs/layout-parity.md
2026-11-19 10:25:31 +00:00
jayzed80 2bce6ed613 Docs: qualify wrapped-tab float-skip parity entry with 50-span limit (#6577) 2026-11-19 10:09:54 +00:00
jayzed80 03b20a6ca9 #6577: limit the clear-of-float tab skip to stops past the right indent
A left tab whose stop is inside the right indent but past a span narrowed
by a float could take the new skip too, moving its text to a line clear of
the object. The guard now also requires the stop to be past the paragraph's
right text edge, which is the scope the change describes.

Test: a_left_tab_inside_the_right_indent_beside_a_float_keeps_its_line.
The parity row no longer claims the Word comparison was made.
2026-11-19 03:54:39 +00:00
jayzed80 e27a3bbdfc Merge upstream/main into fix/tab-past-indent-float-6577 2026-11-19 03:40:46 +00:00
jayzed80 2e9699c519 Merge remote-tracking branch 'upstream/main' into HEAD
# Conflicts:
#	docs/layout-parity.md
2026-11-18 21:30:04 +00:00
jayzed80 7f8283a77f Layout: a left tab past the right indent beside a float moves clear of it (#6577)
A left tab whose stop is past the right indent wraps to start the next
line. When that line was the span on a floating object's far side, the
tab took no room there and its text started beside the object. Like
Word, the tab now goes on to the first line clear of the object, where
its text starts at the indent.

Test: left_tab_past_the_right_indent_beside_a_float_moves_clear_of_it.
2026-11-14 06:48:10 +00:00
3 changed files with 74 additions and 1 deletions
+8
View File
@@ -876,6 +876,14 @@ impl Scan {
bk.wrapped_tab = Some(j);
return true;
}
if bk.wrapped_tab == Some(j) && self.narrowed && stop.pos > bk.base_right + 0.01 && bk.skipped < 50 {
// A left tab past the right indent that wrapped into a span narrowed by a
// floating object (the far side of it, say): like Word, it goes on to the
// first line clear of the object (#6577). A stop inside the right indent
// keeps the zero-width path below.
self.skip = true;
return true;
}
if bk.wrapped_tab == Some(j) {
// Still past the right indent on the line it wrapped to: it takes no
// room, and its text starts at the indent rather than on a line of its own.
+64
View File
@@ -2028,6 +2028,70 @@ fn left_tab_past_the_right_indent_does_not_add_a_line() {
assert!((page.x - 72.0).abs() < 0.5, "the text after the tab starts at the indent: {}", page.x);
}
/// Beside a floating object the wrapped tab doesn't start its text in the span on the object's
/// far side: like Word, it goes to the first line clear of the object, and its text starts at the
/// indent there (#6577).
#[test]
fn left_tab_past_the_right_indent_beside_a_float_moves_clear_of_it() {
use wordcraft_doc::props::{TabAlign, TabLeader, TabStop};
crate::test_fonts();
let mut d = Document::from_text("Name\tPage");
d.format_paragraphs(&Pos::body(0, 0), &Pos::body(0, 0), &|p| {
p.tabs = Some(vec![TabStop { pos: 500.0, align: TabAlign::Left, leader: TabLeader::None }])
})
.unwrap();
// A box in the middle of the column, anchored after the text so the offsets stay those of
// "Name\tPage": the rows beside it have a span on each side.
let float = wordcraft_doc::para::Float {
wrap: wordcraft_doc::para::Wrap::Square,
h_rel: wordcraft_doc::para::Anchor::Column,
v_rel: wordcraft_doc::para::Anchor::Paragraph,
x: 184.0,
y: 0.0,
dist: 9.0,
..Default::default()
};
let id = text_box(&mut d, 9, "", 100.0, 43.0, float);
let l = lay(&d);
let r = box_rect(&l, id);
let name = l.caret(&Pos::body(0, 0)).unwrap();
assert!((name.x - 72.0).abs() < 0.5 && name.top < r.bottom(), "the text before the tab starts beside the box: {name:?}, box {r:?}");
let page = l.caret(&Pos::body(0, 5)).unwrap();
assert!((page.x - 72.0).abs() < 0.5, "the text after the tab starts at the indent, not beside the box: {page:?}, box {r:?}");
assert!(page.top >= r.bottom() - 0.5, "the text after the tab starts below the box: {page:?}, box {r:?}");
}
/// A left tab whose stop is inside the right indent is not a tab "past the right indent": beside
/// a floating object it keeps the zero-width path, its text starting where the span does, and is
/// not moved clear of the object (#6577).
#[test]
fn a_left_tab_inside_the_right_indent_beside_a_float_keeps_its_line() {
use wordcraft_doc::props::{TabAlign, TabLeader, TabStop};
crate::test_fonts();
let mut d = Document::from_text("Name\tPage");
d.format_paragraphs(&Pos::body(0, 0), &Pos::body(0, 0), &|p| {
p.tabs = Some(vec![TabStop { pos: 400.0, align: TabAlign::Left, leader: TabLeader::None }])
})
.unwrap();
// A box against the right indent, anchored after the text: every row beside it has only the
// span on its left, which ends before the 400 pt stop (inside the 468 pt text width).
let float = wordcraft_doc::para::Float {
wrap: wordcraft_doc::para::Wrap::Square,
h_rel: wordcraft_doc::para::Anchor::Column,
v_rel: wordcraft_doc::para::Anchor::Paragraph,
x: 360.0,
y: 0.0,
dist: 9.0,
..Default::default()
};
let id = text_box(&mut d, 9, "", 100.0, 100.0, float);
let l = lay(&d);
let r = box_rect(&l, id);
let page = l.caret(&Pos::body(0, 5)).unwrap();
assert!((page.x - 72.0).abs() < 0.5, "the text after the tab starts where the span does, not at the stop: {page:?}, box {r:?}");
assert!(page.top < r.bottom() - 0.5, "the text after the tab stays beside the box: {page:?}, box {r:?}");
}
/// A bookmark before such a tab is not text: the tab does not wrap away from it, and the
/// paragraph breaks as it does without the bookmark (no line holding only the bookmark).
#[test]
File diff suppressed because one or more lines are too long