mirror of
https://github.com/helix-editor/helix.git
synced 2024-09-19 14:47:59 +03:00
Move FilePicker struct def closer to impl block
This commit is contained in:
parent
15cc09fc81
commit
fc111213b5
@ -77,36 +77,6 @@ fn from(v: DocumentId) -> Self {
|
||||
/// File path and range of lines (used to align and highlight lines)
|
||||
pub type FileLocation = (PathOrId, Option<(usize, usize)>);
|
||||
|
||||
pub struct FilePicker<T: Item> {
|
||||
options: Vec<T>,
|
||||
editor_data: T::Data,
|
||||
// filter: String,
|
||||
matcher: Box<Matcher>,
|
||||
matches: Vec<PickerMatch>,
|
||||
|
||||
/// Current height of the completions box
|
||||
completion_height: u16,
|
||||
|
||||
cursor: usize,
|
||||
// pattern: String,
|
||||
prompt: Prompt,
|
||||
previous_pattern: (String, FuzzyQuery),
|
||||
/// Whether to show the preview panel (default true)
|
||||
show_preview: bool,
|
||||
/// Constraints for tabular formatting
|
||||
widths: Vec<Constraint>,
|
||||
|
||||
callback_fn: PickerCallback<T>,
|
||||
|
||||
picker: Picker<T>,
|
||||
pub truncate_start: bool,
|
||||
/// Caches paths to documents
|
||||
preview_cache: HashMap<PathBuf, CachedPreview>,
|
||||
read_buffer: Vec<u8>,
|
||||
/// Given an item in the picker, return the file path and line number to display.
|
||||
file_fn: FileCallback<T>,
|
||||
}
|
||||
|
||||
pub enum CachedPreview {
|
||||
Document(Box<Document>),
|
||||
Binary,
|
||||
@ -144,6 +114,36 @@ fn placeholder(&self) -> &str {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct FilePicker<T: Item> {
|
||||
options: Vec<T>,
|
||||
editor_data: T::Data,
|
||||
// filter: String,
|
||||
matcher: Box<Matcher>,
|
||||
matches: Vec<PickerMatch>,
|
||||
|
||||
/// Current height of the completions box
|
||||
completion_height: u16,
|
||||
|
||||
cursor: usize,
|
||||
// pattern: String,
|
||||
prompt: Prompt,
|
||||
previous_pattern: (String, FuzzyQuery),
|
||||
/// Whether to show the preview panel (default true)
|
||||
show_preview: bool,
|
||||
/// Constraints for tabular formatting
|
||||
widths: Vec<Constraint>,
|
||||
|
||||
callback_fn: PickerCallback<T>,
|
||||
|
||||
picker: Picker<T>,
|
||||
pub truncate_start: bool,
|
||||
/// Caches paths to documents
|
||||
preview_cache: HashMap<PathBuf, CachedPreview>,
|
||||
read_buffer: Vec<u8>,
|
||||
/// Given an item in the picker, return the file path and line number to display.
|
||||
file_fn: FileCallback<T>,
|
||||
}
|
||||
|
||||
impl<T: Item + 'static> FilePicker<T> {
|
||||
pub fn new(
|
||||
options: Vec<T>,
|
||||
|
Loading…
Reference in New Issue
Block a user