@@ -77,36 +77,6 @@ type FileCallback<T> = Box<dyn Fn(&Editor, &T) -> Option<FileLocation>>;
7777/// File path and range of lines (used to align and highlight lines)
7878pub type FileLocation = (PathOrId, Option<(usize, usize)>);
7979
80−pub struct FilePicker<T: Item> {
81− options: Vec<T>,
82− editor_data: T::Data,
83− // filter: String,
84− matcher: Box<Matcher>,
85− matches: Vec<PickerMatch>,
86−
87− /// Current height of the completions box
88− completion_height: u16,
89−
90− cursor: usize,
91− // pattern: String,
92− prompt: Prompt,
93− previous_pattern: (String, FuzzyQuery),
94− /// Whether to show the preview panel (default true)
95− show_preview: bool,
96− /// Constraints for tabular formatting
97− widths: Vec<Constraint>,
98−
99− callback_fn: PickerCallback<T>,
100−
101− picker: Picker<T>,
102− pub truncate_start: bool,
103− /// Caches paths to documents
104− preview_cache: HashMap<PathBuf, CachedPreview>,
105− read_buffer: Vec<u8>,
106− /// Given an item in the picker, return the file path and line number to display.
107− file_fn: FileCallback<T>,
108−}
109−
11080pub enum CachedPreview {
11181 Document(Box<Document>),
11282 Binary,
@@ -144,6 +114,36 @@ impl Preview<'_, '_> {
144114 }
145115}
146116
117+pub struct FilePicker<T: Item> {
118+ options: Vec<T>,
119+ editor_data: T::Data,
120+ // filter: String,
121+ matcher: Box<Matcher>,
122+ matches: Vec<PickerMatch>,
123+
124+ /// Current height of the completions box
125+ completion_height: u16,
126+
127+ cursor: usize,
128+ // pattern: String,
129+ prompt: Prompt,
130+ previous_pattern: (String, FuzzyQuery),
131+ /// Whether to show the preview panel (default true)
132+ show_preview: bool,
133+ /// Constraints for tabular formatting
134+ widths: Vec<Constraint>,
135+
136+ callback_fn: PickerCallback<T>,
137+
138+ picker: Picker<T>,
139+ pub truncate_start: bool,
140+ /// Caches paths to documents
141+ preview_cache: HashMap<PathBuf, CachedPreview>,
142+ read_buffer: Vec<u8>,
143+ /// Given an item in the picker, return the file path and line number to display.
144+ file_fn: FileCallback<T>,
145+}
146+
147147impl<T: Item + 'static> FilePicker<T> {
148148 pub fn new(
149149 options: Vec<T>,