Add clear recent files history command (#42176)
 Release Notes: - Added "workspace: clear navigation history" command
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user