aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorGokul Soumya2023-06-18 17:14:41 +0000
committerMichael Davis2023-06-18 17:14:41 +0000
commitfc111213b5b5a3130399cda8a1964fa89acf153a (patch)
tree8b78540a7141b5fbfeea0f75671b48712a78de4a /helix-term/src
parent15cc09fc81d971cb9dbc2d5132e43919601190c2 (diff)
Move FilePicker struct def closer to impl block
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/ui/picker.rs60
1 files changed, 30 insertions, 30 deletions
diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs
index 902c16a0..c06918d4 100644
--- a/helix-term/src/ui/picker.rs
+++ b/helix-term/src/ui/picker.rs
@@ -77,36 +77,6 @@ type FileCallback<T> = Box<dyn Fn(&Editor, &T) -> Option<FileLocation>>;
/// 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 @@ impl Preview<'_, '_> {
}
}
+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>,