Add clear recent files history command (#42176)

![2025-11-07
181619](https://github.com/user-attachments/assets/a9bef7a6-dc0b-4db2-85e5-2e1df7b21cfa)


Release Notes:

- Added "workspace: clear navigation history" command
This commit is contained in:
Libon
2025-11-11 15:42:00 +02:00
committed by GitHub
parent 58db38722b
commit 9be5e31aca
3 changed files with 128 additions and 0 deletions
+13
View File
@@ -199,6 +199,8 @@ actions!(
AddFolderToProject,
/// Clears all notifications.
ClearAllNotifications,
/// Clears all navigation history, including forward/backward navigation, recently opened files, and recently closed tabs. **This action is irreversible**.
ClearNavigationHistory,
/// Closes the active dock.
CloseActiveDock,
/// Closes all docks.
@@ -1917,6 +1919,12 @@ impl Workspace {
.collect()
}
pub fn clear_navigation_history(&mut self, _window: &mut Window, cx: &mut Context<Workspace>) {
for pane in &self.panes {
pane.update(cx, |pane, cx| pane.nav_history_mut().clear(cx));
}
}
fn navigate_history(
&mut self,
pane: WeakEntity<Pane>,
@@ -5858,6 +5866,11 @@ impl Workspace {
workspace.clear_all_notifications(cx);
},
))
.on_action(cx.listener(
|workspace: &mut Workspace, _: &ClearNavigationHistory, window, cx| {
workspace.clear_navigation_history(window, cx);
},
))
.on_action(cx.listener(
|workspace: &mut Workspace, _: &SuppressNotification, _, cx| {
if let Some((notification_id, _)) = workspace.notifications.pop() {