@@ -91,15 +91,25 @@ impl<T> FilePicker<T> {
91 callback_fn: impl Fn(&mut Context, &T, Action) + 'static,
91 callback_fn: impl Fn(&mut Context, &T, Action) + 'static,
92 preview_fn: impl Fn(&Editor, &T) -> Option<FileLocation> + 'static,
92 preview_fn: impl Fn(&Editor, &T) -> Option<FileLocation> + 'static,
93 ) -> Self {
93 ) -> Self {
94+ let truncate_start = true;
95+ let mut picker = Picker::new(options, format_fn, callback_fn);
96+ picker.truncate_start = truncate_start;
95− picker: Picker::new(options, format_fn, callback_fn),
99+ picker,
96− truncate_start: true,
100+ truncate_start,
97 preview_cache: HashMap::new(),
101 preview_cache: HashMap::new(),
98 read_buffer: Vec::with_capacity(1024),
102 read_buffer: Vec::with_capacity(1024),
99 file_fn: Box::new(preview_fn),
103 file_fn: Box::new(preview_fn),
107+ pub fn truncate_start(mut self, truncate_start: bool) -> Self {
108+ self.truncate_start = truncate_start;
109+ self.picker.truncate_start = truncate_start;
103 fn current_file(&self, editor: &Editor) -> Option<FileLocation> {
113 fn current_file(&self, editor: &Editor) -> Option<FileLocation> {
104 self.picker
114 self.picker
105 .selection()
115 .selection()
@@ -176,7 +186,6 @@ impl<T: 'static> Component for FilePicker<T> {
178 let picker_area = area.with_width(picker_width);
188 let picker_area = area.with_width(picker_width);
179− self.picker.truncate_start = self.truncate_start;
180 self.picker.render(picker_area, surface, cx);
189 self.picker.render(picker_area, surface, cx);
182 if !render_preview {
191 if !render_preview {