Skip to content

Commit

Permalink
update api
Browse files Browse the repository at this point in the history
  • Loading branch information
raphamorim committed Oct 8, 2024
1 parent a424be7 commit 5f1adfa
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 23 deletions.
8 changes: 4 additions & 4 deletions frontends/rioterm/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ impl ApplicationHandler<EventPayload> for Application<'_> {
}
}
RioEventType::Rio(RioEvent::CreateConfigEditor) => {
if self.config.split.enable {
if self.config.navigation.use_split {
self.router.open_config_split(&self.config);
} else {
self.router.open_config_window(
Expand Down Expand Up @@ -1084,7 +1084,7 @@ impl ApplicationHandler<EventPayload> for Application<'_> {
}

fn open_config(&mut self, event_loop: &ActiveEventLoop) {
if self.config.split.enable {
if self.config.navigation.use_split {
self.router.open_config_split(&self.config);
} else {
self.router.open_config_window(
Expand Down Expand Up @@ -1128,12 +1128,12 @@ impl ApplicationHandler<EventPayload> for Application<'_> {
route.window.screen.close_split_or_tab();
}
Hook::SplitDown => {
if self.config.split.enable {
if self.config.navigation.use_split {
route.window.screen.split_down();
}
}
Hook::SplitRight => {
if self.config.split.enable {
if self.config.navigation.use_split {
route.window.screen.split_right();
}
}
Expand Down
26 changes: 8 additions & 18 deletions frontends/rioterm/src/context/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::context::Context;
use rio_backend::crosswords::grid::Dimensions;
use rio_backend::event::EventListener;
use rio_backend::sugarloaf::{
layout::SugarDimensions, Rect, ComposedQuad, Object, Quad, RichText,
layout::SugarDimensions, ComposedQuad, Object, Quad, Rect, RichText,
};

const MIN_COLS: usize = 2;
Expand Down Expand Up @@ -80,11 +80,7 @@ impl<T: rio_backend::event::EventListener> ContextGridItem<T> {
}

impl<T: rio_backend::event::EventListener> ContextGrid<T> {
pub fn new(
context: Context<T>,
margin: Delta<f32>,
border_color: [f32; 4],
) -> Self {
pub fn new(context: Context<T>, margin: Delta<f32>, border_color: [f32; 4]) -> Self {
let width = context.dimension.width;
let height = context.dimension.height;
let inner = vec![ContextGridItem::new(context)];
Expand Down Expand Up @@ -211,11 +207,12 @@ impl<T: rio_backend::event::EventListener> ContextGrid<T> {
x: margin.x,
top_y: margin.top_y
+ PADDING
+ (item.val.dimension.height / item.val.dimension.dimension.scale),
+ (item.val.dimension.height
/ item.val.dimension.dimension.scale),
bottom_y: margin.bottom_y,
};

objects.push(Object::Rect(Rect {
objects.push(Object::Rect(Rect {
position: [new_margin.x, new_margin.top_y - PADDING],
color: self.border_color,
size: [
Expand Down Expand Up @@ -465,11 +462,7 @@ pub mod test {
let context_width = context.dimension.width;
let context_height = context.dimension.height;
let context_margin = context.dimension.margin;
let grid = ContextGrid::<VoidListener>::new(
context,
margin,
[0., 0., 0., 0.],
);
let grid = ContextGrid::<VoidListener>::new(context, margin, [0., 0., 0., 0.]);
// The first context should fill completely w/h grid
assert_eq!(grid.width, context_width);
assert_eq!(grid.height, context_height);
Expand Down Expand Up @@ -541,11 +534,8 @@ pub mod test {
)
};

let mut grid = ContextGrid::<VoidListener>::new(
first_context,
margin,
[0., 0., 0., 0.],
);
let mut grid =
ContextGrid::<VoidListener>::new(first_context, margin, [0., 0., 0., 0.]);

assert_eq!(
grid.objects(),
Expand Down
2 changes: 1 addition & 1 deletion frontends/rioterm/src/screen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ impl Screen<'_> {
let bindings = crate::bindings::default_key_bindings(
config.bindings.keys.to_owned(),
config.navigation.has_navigation_key_bindings(),
config.split.enable,
config.navigation.use_split,
config.keyboard,
);
let ime = Ime::new();
Expand Down

0 comments on commit 5f1adfa

Please sign in to comment.