Try to reveal selection changing issues in undo/redo via logging (#25676)

This will hopefully help debug #22692. I tried this for a while locally
and saw neither these logs nor the issue.

Release Notes:

- N/A
This commit is contained in:
Michael Sloan 2025-02-26 12:48:15 -07:00 committed by GitHub
parent c53020ceaf
commit add7ae8052
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8778,6 +8778,13 @@ impl Editor {
self.change_selections(None, window, cx, |s| {
s.select_anchors(selections.to_vec());
});
} else {
log::error!(
"No entry in selection_history found for undo. \
This may correspond to a bug where undo does not update the selection. \
If this is occurring, please add details to \
https://github.com/zed-industries/zed/issues/22692"
);
}
self.request_autoscroll(Autoscroll::fit(), cx);
self.unmark_text(window, cx);
@ -8799,6 +8806,13 @@ impl Editor {
self.change_selections(None, window, cx, |s| {
s.select_anchors(selections.to_vec());
});
} else {
log::error!(
"No entry in selection_history found for redo. \
This may correspond to a bug where undo does not update the selection. \
If this is occurring, please add details to \
https://github.com/zed-industries/zed/issues/22692"
);
}
self.request_autoscroll(Autoscroll::fit(), cx);
self.unmark_text(window, cx);