Skip to content

Commit 44ad79d

Browse files
committed
fix(fix): patched content should be created in autofix
1 parent e5a8975 commit 44ad79d

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/runtime.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -106,19 +106,19 @@ impl Runtime {
106106
eprintln!("{}", serde_json::to_string(&diag).unwrap());
107107
}
108108
}
109-
// Autofix use history.
110-
if let Some(&last) = context.history.get(&icon.codepoint) {
111-
cprintln!("# Auto fix it using last input '{}'".green, last);
112-
ch = last;
113-
// Autofix use replacing.
114-
} else if let Some(new) = self.try_replace(context, icon) {
115-
cprintln!("# Auto replace it with '{}'".green, new);
116-
ch = new;
117-
} else {
109+
if does_fix {
110+
// Push all non-patched content.
111+
let res = result.get_or_insert_with(|| content[..start].to_owned());
112+
// Autofix use history.
113+
if let Some(&last) = context.history.get(&icon.codepoint) {
114+
cprintln!("# Auto fix it using last input '{}'".green, last);
115+
ch = last;
116+
// Autofix use replacing.
117+
} else if let Some(new) = self.try_replace(context, icon) {
118+
cprintln!("# Auto replace it with '{}'".green, new);
119+
ch = new;
118120
// Input a new icon
119-
if does_fix {
120-
// Push all non-patched content.
121-
let res = result.get_or_insert_with(|| content[..start].to_owned());
121+
} else {
122122
match self.prompt_input_icon(Some(candidates.get()?)) {
123123
Ok(Some(new)) => {
124124
context.history.insert(icon.codepoint, new);

0 commit comments

Comments
 (0)