mirror of
https://github.com/storytold/wordcraft.git
synced 2026-11-06 02:09:46 -06:00
M7: apply the hosted rustfmt corrections to the proofing pane
Apply the six formatting hunks reported by the exact-head Printing/CI runs. No behavior change. cargo xtask ci was attempted locally but cargo is absent; hosted checks must validate this revision.
This commit is contained in:
@@ -999,9 +999,12 @@ fn next_issue(s: &mut Session, v: &Value) -> CmdResult {
|
||||
// Scan forward first, including the rest of the caret's paragraph. A second pass
|
||||
// optionally visits the earlier part; never select the first typo repeatedly in
|
||||
// a single-paragraph story. Dialogs disable wrapping so Ignore Once can finish.
|
||||
for (path, before) in paths.iter().skip(start).map(|path| (path, false)).chain(
|
||||
paths.iter().take(if wrap { start.saturating_add(1) } else { 0 }).map(|path| (path, true)),
|
||||
) {
|
||||
for (path, before) in paths
|
||||
.iter()
|
||||
.skip(start)
|
||||
.map(|path| (path, false))
|
||||
.chain(paths.iter().take(if wrap { start.saturating_add(1) } else { 0 }).map(|path| (path, true)))
|
||||
{
|
||||
for (a, b, i) in para_issues(s, story, path) {
|
||||
if *path == caret.path && (a.off < caret.off) != before {
|
||||
continue;
|
||||
|
||||
@@ -1121,7 +1121,9 @@ impl WordApp {
|
||||
}
|
||||
// User proofing opens the persistent task pane; scripts keep structured results.
|
||||
// Right-click and Shift+F10 retain their compact suggestions menu.
|
||||
if matches!(id, "review.spelling" | "review.editor") && let Ok(v) = &r {
|
||||
if matches!(id, "review.spelling" | "review.editor")
|
||||
&& let Ok(v) = &r
|
||||
{
|
||||
self.spelling_review = Some(proofing_pane::SpellingForm::new(self, v.clone()));
|
||||
}
|
||||
let r = system_clipboard::explain(self, id, r);
|
||||
|
||||
@@ -52,8 +52,8 @@ impl SpellingForm {
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) fn content_text(&self) -> Vec<String> {
|
||||
let mut text: Vec<String> = self.issue.get("suggestions").and_then(Value::as_array).into_iter().flatten()
|
||||
.filter_map(Value::as_str).map(str::to_string).collect();
|
||||
let mut text: Vec<String> =
|
||||
self.issue.get("suggestions").and_then(Value::as_array).into_iter().flatten().filter_map(Value::as_str).map(str::to_string).collect();
|
||||
text.push(format!("{}{}{}", self.context_before, self.issue.get("text").and_then(Value::as_str).unwrap_or(""), self.context_after));
|
||||
text
|
||||
}
|
||||
@@ -149,8 +149,8 @@ fn body(app: &mut WordApp, ui: &mut Ui, form: &mut SpellingForm) {
|
||||
context(ui, app, form, spelling);
|
||||
ui.add_space(12.0);
|
||||
ui.label(egui::RichText::new(tl!("Suggestions")).font(regular(11.0)).color(t.text_dim));
|
||||
let suggestions: Vec<String> = form.issue.get("suggestions").and_then(Value::as_array).into_iter().flatten()
|
||||
.filter_map(Value::as_str).map(str::to_string).collect();
|
||||
let suggestions: Vec<String> =
|
||||
form.issue.get("suggestions").and_then(Value::as_array).into_iter().flatten().filter_map(Value::as_str).map(str::to_string).collect();
|
||||
let mut change = None;
|
||||
if suggestions.is_empty() {
|
||||
ui.label(egui::RichText::new(tl!("(no suggestions)")).italics());
|
||||
@@ -170,7 +170,11 @@ fn body(app: &mut WordApp, ui: &mut Ui, form: &mut SpellingForm) {
|
||||
ui.painter().rect_filled(rect, 0.0, t.hover);
|
||||
}
|
||||
ui.painter().with_clip_rect(rect.shrink2(vec2(10.0, 0.0))).text(
|
||||
rect.left_center() + vec2(12.0, 0.0), Align2::LEFT_CENTER, suggestion, semibold(12.5), t.text,
|
||||
rect.left_center() + vec2(12.0, 0.0),
|
||||
Align2::LEFT_CENTER,
|
||||
suggestion,
|
||||
semibold(12.5),
|
||||
t.text,
|
||||
);
|
||||
if response.clicked() {
|
||||
change = Some(suggestion.clone());
|
||||
@@ -197,7 +201,9 @@ fn body(app: &mut WordApp, ui: &mut Ui, form: &mut SpellingForm) {
|
||||
let _ = app.run("tools.autocorrect", json!({}));
|
||||
ui.close();
|
||||
}
|
||||
}).response.on_hover_text(tl!("More options"));
|
||||
})
|
||||
.response
|
||||
.on_hover_text(tl!("More options"));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user