Skip to content

Commit

Permalink
fix(fix): patched content should be created in autofix
Browse files Browse the repository at this point in the history
  • Loading branch information
loichyan committed May 2, 2023
1 parent e5a8975 commit 44ad79d
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,19 @@ impl Runtime {
eprintln!("{}", serde_json::to_string(&diag).unwrap());
}
}
// Autofix use history.
if let Some(&last) = context.history.get(&icon.codepoint) {
cprintln!("# Auto fix it using last input '{}'".green, last);
ch = last;
// Autofix use replacing.
} else if let Some(new) = self.try_replace(context, icon) {
cprintln!("# Auto replace it with '{}'".green, new);
ch = new;
} else {
if does_fix {
// Push all non-patched content.
let res = result.get_or_insert_with(|| content[..start].to_owned());
// Autofix use history.
if let Some(&last) = context.history.get(&icon.codepoint) {
cprintln!("# Auto fix it using last input '{}'".green, last);
ch = last;
// Autofix use replacing.
} else if let Some(new) = self.try_replace(context, icon) {
cprintln!("# Auto replace it with '{}'".green, new);
ch = new;
// Input a new icon
if does_fix {
// Push all non-patched content.
let res = result.get_or_insert_with(|| content[..start].to_owned());
} else {
match self.prompt_input_icon(Some(candidates.get()?)) {
Ok(Some(new)) => {
context.history.insert(icon.codepoint, new);
Expand Down

0 comments on commit 44ad79d

Please sign in to comment.