mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-03 17:24:42 +00:00
chore: restore formatting and lint gates for preserved edits
Remove the rectangle helper whose only caller was the deleted crop test, and format the preserved text_script tool additions. Co-Authored-By: Codex GPT-6.1 <noreply@openai.com>
This commit is contained in:
1 parent
355078d141
commit
d08097f286
3 files changed
+5
-20
No files matched your search
@@ -886,9 +886,9 @@ impl Automation {
|
||||
[start, end] => usize::try_from(*start).ok().zip(usize::try_from(*end).ok()),
|
||||
_ => None,
|
||||
};
|
||||
let range = bounds.map(|(start, end)| start..end).filter(|r| {
|
||||
r.start < r.end && r.end <= text.len() && text.is_char_boundary(r.start) && text.is_char_boundary(r.end)
|
||||
});
|
||||
let range = bounds
|
||||
.map(|(start, end)| start..end)
|
||||
.filter(|r| r.start < r.end && r.end <= text.len() && text.is_char_boundary(r.start) && text.is_char_boundary(r.end));
|
||||
let Some(range) = range else {
|
||||
return Err(ToolError::InvalidArgs(format!(
|
||||
"range must be [start, end]: UTF-8 byte offsets of the paragraph's editor_text (from text_paragraphs) with start < end <= {}, on character boundaries",
|
||||
|
||||
@@ -3293,7 +3293,8 @@ fn superscript_and_subscript_through_tools() {
|
||||
let dir = workdir("text-script");
|
||||
let mut a = auto(&dir);
|
||||
let doc = ok(&mut a, "doc_open", json!({ "path": "a.pdf" }))["doc"].as_u64().unwrap();
|
||||
let paragraph = |a: &mut Automation| ok(a, "text_paragraphs", json!({ "doc": doc, "page": 2 }))["paragraphs"][0]["text"].as_str().unwrap().to_string();
|
||||
let paragraph =
|
||||
|a: &mut Automation| ok(a, "text_paragraphs", json!({ "doc": doc, "page": 2 }))["paragraphs"][0]["text"].as_str().unwrap().to_string();
|
||||
let script = |script: &str, range: Value| json!({ "doc": doc, "page": 2, "paragraph": 1, "script": script, "range": range });
|
||||
// "Page 2": the 2 is byte 5.
|
||||
let r = ok(&mut a, "text_script", script("superscript", json!([5, 6])));
|
||||
|
||||
@@ -7724,22 +7724,6 @@ fn rotated_image_selection_and_crop() {
|
||||
assert!(h.state().views[0].image_selection.as_ref().is_some_and(|s| s.crop.is_none()), "crop mode ended");
|
||||
}
|
||||
|
||||
trait RectExt {
|
||||
fn width(&self) -> f64;
|
||||
}
|
||||
|
||||
impl RectExt for [f64; 4] {
|
||||
fn width(&self) -> f64 {
|
||||
(self[2] - self[0]).abs()
|
||||
}
|
||||
}
|
||||
|
||||
impl RectExt for egui::Rect {
|
||||
fn width(&self) -> f64 {
|
||||
f64::from(self.width())
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_image_8_handles_render_and_drag() {
|
||||
let mut png = Vec::new();
|
||||
|
||||
Reference in new issue
Block a user