mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
Strictly!
This commit is contained in:
parent
279378e8f1
commit
85b84e22da
2 changed files with 17 additions and 15 deletions
|
|
@ -2,7 +2,7 @@ use crossterm::terminal::WindowSize;
|
||||||
use ratatui::prelude::Rect;
|
use ratatui::prelude::Rect;
|
||||||
use yazi_shared::Term;
|
use yazi_shared::Term;
|
||||||
|
|
||||||
use crate::{completion::Completion, help::Help, input::Input, manager::Manager, select::Select, tasks::Tasks, which::Which, Position, Offset};
|
use crate::{completion::Completion, help::Help, input::Input, manager::Manager, select::Select, tasks::Tasks, which::Which, Offset, Position};
|
||||||
|
|
||||||
pub struct Ctx {
|
pub struct Ctx {
|
||||||
pub manager: Manager,
|
pub manager: Manager,
|
||||||
|
|
@ -125,18 +125,21 @@ impl Ctx {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Position::Sticky(Offset { x_offset, y_offset, width, height }, r) => {
|
Position::Sticky(Offset { x_offset, y_offset, width, height }, r) => {
|
||||||
// TODO:
|
let base_x = r.x;
|
||||||
unimplemented!("Position::Sticky is not implemented");
|
let base_y = r.y;
|
||||||
// let mut x = columns.saturating_sub(width);
|
if base_y.saturating_add(height).saturating_add(r.height).saturating_add_signed(y_offset)
|
||||||
// x = x.saturating_add_signed(x_offset);
|
> rows
|
||||||
// let mut y = r.y;
|
{
|
||||||
// y = y.saturating_add_signed(y_offset);
|
(
|
||||||
|
base_x.saturating_add_signed(x_offset).max(0).min(columns.saturating_sub(width)),
|
||||||
// if y + height + r.height > rows {
|
base_y.saturating_sub(height.saturating_sub(y_offset.unsigned_abs())),
|
||||||
// (x + r.x, r.y.saturating_sub(height.saturating_sub(y)))
|
)
|
||||||
// } else {
|
} else {
|
||||||
// (x + r.x, y + r.height)
|
(
|
||||||
// }
|
base_x.saturating_add_signed(x_offset),
|
||||||
|
base_y.saturating_add(r.height).saturating_add_signed(y_offset),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ use std::path::MAIN_SEPARATOR;
|
||||||
|
|
||||||
use ratatui::{buffer::Buffer, layout::Rect, widgets::{Block, BorderType, Borders, Clear, List, ListItem, Widget}};
|
use ratatui::{buffer::Buffer, layout::Rect, widgets::{Block, BorderType, Borders, Clear, List, ListItem, Widget}};
|
||||||
use yazi_config::THEME;
|
use yazi_config::THEME;
|
||||||
use yazi_core::{Ctx, Position, Offset};
|
use yazi_core::{Ctx, Offset, Position};
|
||||||
|
|
||||||
pub(crate) struct Completion<'a> {
|
pub(crate) struct Completion<'a> {
|
||||||
cx: &'a Ctx,
|
cx: &'a Ctx,
|
||||||
|
|
@ -40,7 +40,6 @@ impl<'a> Widget for Completion<'a> {
|
||||||
|
|
||||||
let input_area = self.cx.area(&self.cx.input.position);
|
let input_area = self.cx.area(&self.cx.input.position);
|
||||||
let mut area = self.cx.area(&Position::Sticky(
|
let mut area = self.cx.area(&Position::Sticky(
|
||||||
// TODO:
|
|
||||||
Offset {
|
Offset {
|
||||||
x_offset: 1,
|
x_offset: 1,
|
||||||
y_offset: 0,
|
y_offset: 0,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue