mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-10 09:59:47 -06:00
Variables: Undo and Redo clear a highlight that names no variable
Undo, Redo and a canceled undo group put back an earlier document but left the Variables panel highlight as it was. After renaming the highlighted variable and undoing, the highlight still named the new name: a variable defined later under that name showed highlighted without a click, and Delete removed it. Each of these paths now clears a highlight whose variable the restored document does not define, as Delete Variables and Load Variable Library already did.
This commit is contained in:
@@ -277,9 +277,7 @@ pub(super) fn load_library(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
})?;
|
||||
// A highlight of a variable that is gone highlights nothing.
|
||||
let st = s.doc_mut()?;
|
||||
if st.variables_highlight.as_ref().is_some_and(|h| st.doc.variables.variable(h).is_none()) {
|
||||
st.variables_highlight = None;
|
||||
}
|
||||
st.drop_stale_variables_highlight();
|
||||
st.revision += 1;
|
||||
let skipped: Vec<Value> = lib.other.iter().map(|(name, t)| json!({"name": name, "trait": t})).collect();
|
||||
let mut out = json!({
|
||||
|
||||
Reference in New Issue
Block a user