Make BufferSearch less wide (#10459)
This also adds some "responsiveness" so that UI elements are hidden before everything has to be occluded Release Notes: - Improved search UI. It now works in narrower panes, and avoids scrolling the editor on open. <img width="899" alt="Screenshot 2024-04-11 at 21 33 17" src="https://github.com/zed-industries/zed/assets/94272/44b95d4f-08d6-4c40-a175-0e594402ca01"> <img width="508" alt="Screenshot 2024-04-11 at 21 33 45" src="https://github.com/zed-industries/zed/assets/94272/baf4638d-427b-43e6-ad67-13d43f0f18a2"> <img width="361" alt="Screenshot 2024-04-11 at 21 34 00" src="https://github.com/zed-industries/zed/assets/94272/ff60b561-2f77-49c0-9df7-e26227fe9225"> <img width="348" alt="Screenshot 2024-04-11 at 21 37 03" src="https://github.com/zed-industries/zed/assets/94272/a2a700a2-ce99-41bd-bf47-9b14d7082b0e">
This commit is contained in:
parent
f2d61f3ea5
commit
08786fa7bf
18 changed files with 326 additions and 482 deletions
|
@ -1,14 +1,12 @@
|
|||
use bitflags::bitflags;
|
||||
pub use buffer_search::BufferSearchBar;
|
||||
use gpui::{actions, Action, AppContext, IntoElement};
|
||||
pub use mode::SearchMode;
|
||||
use project::search::SearchQuery;
|
||||
pub use project_search::ProjectSearchView;
|
||||
use ui::{prelude::*, Tooltip};
|
||||
use ui::{ButtonStyle, IconButton};
|
||||
|
||||
pub mod buffer_search;
|
||||
mod mode;
|
||||
pub mod project_search;
|
||||
pub(crate) mod search_bar;
|
||||
|
||||
|
@ -21,19 +19,17 @@ pub fn init(cx: &mut AppContext) {
|
|||
actions!(
|
||||
search,
|
||||
[
|
||||
CycleMode,
|
||||
FocusSearch,
|
||||
ToggleWholeWord,
|
||||
ToggleCaseSensitive,
|
||||
ToggleIncludeIgnored,
|
||||
ToggleRegex,
|
||||
ToggleReplace,
|
||||
SelectNextMatch,
|
||||
SelectPrevMatch,
|
||||
SelectAllMatches,
|
||||
NextHistoryQuery,
|
||||
PreviousHistoryQuery,
|
||||
ActivateTextMode,
|
||||
ActivateRegexMode,
|
||||
ReplaceAll,
|
||||
ReplaceNext,
|
||||
]
|
||||
|
@ -46,15 +42,17 @@ bitflags! {
|
|||
const WHOLE_WORD = 0b001;
|
||||
const CASE_SENSITIVE = 0b010;
|
||||
const INCLUDE_IGNORED = 0b100;
|
||||
const REGEX = 0b1000;
|
||||
}
|
||||
}
|
||||
|
||||
impl SearchOptions {
|
||||
pub fn label(&self) -> &'static str {
|
||||
match *self {
|
||||
SearchOptions::WHOLE_WORD => "Match Whole Word",
|
||||
SearchOptions::CASE_SENSITIVE => "Match Case",
|
||||
SearchOptions::INCLUDE_IGNORED => "Include ignored",
|
||||
SearchOptions::WHOLE_WORD => "whole word",
|
||||
SearchOptions::CASE_SENSITIVE => "match case",
|
||||
SearchOptions::INCLUDE_IGNORED => "include Ignored",
|
||||
SearchOptions::REGEX => "regular expression",
|
||||
_ => panic!("{:?} is not a named SearchOption", self),
|
||||
}
|
||||
}
|
||||
|
@ -64,6 +62,7 @@ impl SearchOptions {
|
|||
SearchOptions::WHOLE_WORD => ui::IconName::WholeWord,
|
||||
SearchOptions::CASE_SENSITIVE => ui::IconName::CaseSensitive,
|
||||
SearchOptions::INCLUDE_IGNORED => ui::IconName::FileGit,
|
||||
SearchOptions::REGEX => ui::IconName::Regex,
|
||||
_ => panic!("{:?} is not a named SearchOption", self),
|
||||
}
|
||||
}
|
||||
|
@ -73,6 +72,7 @@ impl SearchOptions {
|
|||
SearchOptions::WHOLE_WORD => Box::new(ToggleWholeWord),
|
||||
SearchOptions::CASE_SENSITIVE => Box::new(ToggleCaseSensitive),
|
||||
SearchOptions::INCLUDE_IGNORED => Box::new(ToggleIncludeIgnored),
|
||||
SearchOptions::REGEX => Box::new(ToggleRegex),
|
||||
_ => panic!("{:?} is not a named SearchOption", self),
|
||||
}
|
||||
}
|
||||
|
@ -86,6 +86,7 @@ impl SearchOptions {
|
|||
options.set(SearchOptions::WHOLE_WORD, query.whole_word());
|
||||
options.set(SearchOptions::CASE_SENSITIVE, query.case_sensitive());
|
||||
options.set(SearchOptions::INCLUDE_IGNORED, query.include_ignored());
|
||||
options.set(SearchOptions::REGEX, query.is_regex());
|
||||
options
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue