Add simple support for wrapscan (#13497)

For: #13417 

This is a simple version, I'm not sure if we just need to limit this
feature to vim mode, or maybe in normal editor mode, which involves
other logic like the location of the setting

Release Notes:

- N/A

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
Hans 2024-07-11 10:42:37 +08:00 committed by GitHub
parent 46645b552f
commit 3b823d4a0b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 137 additions and 19 deletions

View file

@ -5,6 +5,8 @@ use project::search::SearchQuery;
pub use project_search::ProjectSearchView;
use ui::{prelude::*, Tooltip};
use ui::{ButtonStyle, IconButton};
use workspace::notifications::NotificationId;
use workspace::{Toast, Workspace};
pub mod buffer_search;
pub mod project_search;
@ -107,3 +109,21 @@ impl SearchOptions {
})
}
}
pub(crate) fn show_no_more_matches(cx: &mut WindowContext) {
cx.defer(|cx| {
struct NotifType();
let notification_id = NotificationId::unique::<NotifType>();
let Some(workspace) = cx.window_handle().downcast::<Workspace>() else {
return;
};
workspace
.update(cx, |workspace, cx| {
workspace.show_toast(
Toast::new(notification_id.clone(), "No more matches").autohide(),
cx,
);
})
.ok();
});
}