Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
* 0.2.10
* BUGFIX: `on_mount` is now called after the children are generated
* BUGFIX: `on_tick` is now run before the cycle call
* BUGFIX: `expand` would make the constraints tight, this is no longer the
case
* 0.2.9
* New function: truncate
* New border style: "rounded"
Expand Down
26 changes: 14 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "anathema"
edition = "2024"
version = "0.2.9"
version = "0.2.10"
license = "MIT"
description = "Create beautiful, easily customisable terminal applications"
keywords = ["tui", "terminal", "widgets", "ui", "layout"]
Expand All @@ -11,6 +11,7 @@ documentation = "https://togglebyte.github.io/anathema-guide/"
homepage = "https://github.com/togglebyte/anathema"
repository = "https://github.com/togglebyte/anathema"
publish = true
rust-version = "1.88"

[dependencies]
anathema-backend = { workspace = true }
Expand Down Expand Up @@ -39,24 +40,24 @@ workspace = true

[workspace.package]
edition = "2024"
version = "0.2.9"
version = "0.2.10"

[workspace.dependencies]
bitflags = "2.4.1"
crossterm = "0.28.1"
unicode-width = "0.1.11"
flume = "0.11.0"
notify = "6.1.1"
anathema-default-widgets = { path = "./anathema-default-widgets", version = "0.2.9" }
anathema-backend = { path = "./anathema-backend", version = "0.2.9" }
anathema-runtime = { path = "./anathema-runtime", version = "0.2.9" }
anathema-state = { path = "./anathema-state", version = "0.2.9" }
anathema-state-derive = { path = "./anathema-state-derive", version = "0.2.9" }
anathema-store = { path = "./anathema-store", version = "0.2.9" }
anathema-templates = { path = "./anathema-templates", version = "0.2.9" }
anathema-widgets = { path = "./anathema-widgets", version = "0.2.9" }
anathema-geometry = { path = "./anathema-geometry", version = "0.2.9" }
anathema-value-resolver = { path = "./anathema-value-resolver", version = "0.2.9" }
anathema-default-widgets = { path = "./anathema-default-widgets", version = "0.2.10" }
anathema-backend = { path = "./anathema-backend", version = "0.2.10" }
anathema-runtime = { path = "./anathema-runtime", version = "0.2.10" }
anathema-state = { path = "./anathema-state", version = "0.2.10" }
anathema-state-derive = { path = "./anathema-state-derive", version = "0.2.10" }
anathema-store = { path = "./anathema-store", version = "0.2.10" }
anathema-templates = { path = "./anathema-templates", version = "0.2.10" }
anathema-widgets = { path = "./anathema-widgets", version = "0.2.10" }
anathema-geometry = { path = "./anathema-geometry", version = "0.2.10" }
anathema-value-resolver = { path = "./anathema-value-resolver", version = "0.2.10" }

[workspace]
members = [
Expand All @@ -83,6 +84,7 @@ should_implement_trait = "allow"
type_complexity = "allow"
too_many_arguments = "allow"
wrong_self_convention = "allow"
collapsible_if = "allow"

[package.metadata.release]
shared-version = true
Expand Down
4 changes: 2 additions & 2 deletions anathema-default-widgets/src/layout/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ pub fn layout_all_expansions<'bp>(
let mut constraints = Constraints::new(sub_size, constraints.max_height());

// Ensure that the rounding doesn't push the constraint outside of the max width
constraints.min_width = constraints.max_width();
constraints.min_width = constraints.min_width.min(constraints.max_width());
constraints
}
Axis::Vertical => {
let mut constraints = Constraints::new(constraints.max_width(), sub_size);

// Ensure that the rounding doesn't push the constraint outside of the max height
constraints.min_height = constraints.max_height();
constraints.min_height = constraints.min_height.min(constraints.max_height());
constraints
}
};
Expand Down
4 changes: 2 additions & 2 deletions anathema-geometry/src/region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ impl Region {
}

/// Check if a region contains a position.
/// Regions are inclusive, so a region from 0,0 to 10, 10 contains both Pos::ZERO and
/// Pos::New(10, 10)
/// Regions are exclusive, so a region from 0,0 to 10, 10 contains `Pos::ZERO`
/// but not `Pos::New(10, 10)`
pub const fn contains(&self, pos: Pos) -> bool {
pos.x >= self.from.x && pos.x < self.to.x && pos.y >= self.from.y && pos.y < self.to.y
}
Expand Down
4 changes: 2 additions & 2 deletions anathema-runtime/src/runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,21 +385,21 @@ impl<'rt, 'bp, G: GlobalEventHandler> Frame<'rt, 'bp, G> {
puffin::GlobalProfiler::lock().new_frame();

let now = Instant::now();
self.init_new_components();
let elapsed = self.handle_messages(now);
self.poll_events(elapsed, now, backend);
self.drain_deferred_commands();
self.drain_assoc_events();
self.tick_components(self.dt.elapsed());

// TODO:
// this secondary call is here to deal with changes causing changes
// which happens when values are removed or inserted and indices needs updating
self.apply_changes()?;
self.apply_changes()?;

self.tick_components(self.dt.elapsed());
self.cycle(backend)?;

self.init_new_components();
self.post_cycle_events();

*self.dt = Instant::now();
Expand Down
2 changes: 1 addition & 1 deletion anathema-testutils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ homepage = "https://github.com/togglebyte/anathema"
repository = "https://github.com/togglebyte/anathema"

[dependencies]
anathema = { path = "../", version = "0.2.9" }
anathema = { path = "../", version = "0.2.10" }

[lints]
workspace = true
4 changes: 1 addition & 3 deletions anathema-widgets/src/nodes/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,7 @@ impl Evaluator for ComponentEval {
.ok_or_else(|| ctx.error(ErrorKind::TreeTransactionFailed))?;
ctx.new_components.push((widget_id, state_id));

let path = tree.path(widget_id);
ctx.components
.push(path, component_id, widget_id, state_id, accept_ticks);
ctx.components.push(component_id, widget_id, state_id, accept_ticks);

Ok(())
}
Expand Down
24 changes: 0 additions & 24 deletions anathema-widgets/src/widget/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::any::Any;
use std::cmp::Ordering;
use std::fmt::{self, Debug};
use std::ops::ControlFlow;

Expand Down Expand Up @@ -39,27 +38,6 @@ pub struct CompEntry {
pub accept_ticks: bool,

component_id: ComponentBlueprintId,
path: Box<[u16]>,
}

impl PartialOrd for CompEntry {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.path.cmp(&other.path))
}
}

impl Ord for CompEntry {
fn cmp(&self, other: &Self) -> Ordering {
self.path.cmp(&other.path)
}
}

impl Eq for CompEntry {}

impl PartialEq for CompEntry {
fn eq(&self, other: &Self) -> bool {
self.path.eq(&other.path)
}
}

/// Store a list of components currently in the tree
Expand All @@ -74,14 +52,12 @@ impl Components {

pub fn push(
&mut self,
path: Box<[u16]>,
component_id: ComponentBlueprintId,
widget_id: WidgetId,
state_id: StateId,
accept_ticks: bool,
) {
let entry = CompEntry {
path,
component_id,
widget_id,
state_id,
Expand Down
Loading