mirror of https://github.com/helix-editor/helix
undo-picker-preview-ratio-change
parent
fe959c80ca
commit
e63f01694b
|
@ -934,18 +934,18 @@ impl<T: 'static + Send + Sync, D: 'static + Send + Sync> Picker<T, D> {
|
||||||
|
|
||||||
impl<I: 'static + Send + Sync, D: 'static + Send + Sync> Component for Picker<I, D> {
|
impl<I: 'static + Send + Sync, D: 'static + Send + Sync> Component for Picker<I, D> {
|
||||||
fn render(&mut self, area: Rect, surface: &mut Surface, cx: &mut Context) {
|
fn render(&mut self, area: Rect, surface: &mut Surface, cx: &mut Context) {
|
||||||
// +---------+ +-------------+
|
// +---------+ +---------+
|
||||||
// |prompt | |preview |
|
// |prompt | |preview |
|
||||||
// +---------+ | |
|
// +---------+ | |
|
||||||
// |picker | | |
|
// |picker | | |
|
||||||
// | | | |
|
// | | | |
|
||||||
// +---------+ +-------------+
|
// +---------+ +---------+
|
||||||
|
|
||||||
let render_preview =
|
let render_preview =
|
||||||
self.show_preview && self.file_fn.is_some() && area.width > MIN_AREA_WIDTH_FOR_PREVIEW;
|
self.show_preview && self.file_fn.is_some() && area.width > MIN_AREA_WIDTH_FOR_PREVIEW;
|
||||||
|
|
||||||
let picker_width = if render_preview {
|
let picker_width = if render_preview {
|
||||||
area.width * 3 / 8
|
area.width / 2
|
||||||
} else {
|
} else {
|
||||||
area.width
|
area.width
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue