Skip to content

Commit 7550693

Browse files
authored
Merge pull request #137 from togglebyte/dev
Version 0.2.10
2 parents bfecd92 + 48654a0 commit 7550693

File tree

8 files changed

+27
-46
lines changed

8 files changed

+27
-46
lines changed

CHANGES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
* 0.2.10
2+
* BUGFIX: `on_mount` is now called after the children are generated
3+
* BUGFIX: `on_tick` is now run before the cycle call
4+
* BUGFIX: `expand` would make the constraints tight, this is no longer the
5+
case
16
* 0.2.9
27
* New function: truncate
38
* New border style: "rounded"

Cargo.toml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "anathema"
33
edition = "2024"
4-
version = "0.2.9"
4+
version = "0.2.10"
55
license = "MIT"
66
description = "Create beautiful, easily customisable terminal applications"
77
keywords = ["tui", "terminal", "widgets", "ui", "layout"]
@@ -11,6 +11,7 @@ documentation = "https://togglebyte.github.io/anathema-guide/"
1111
homepage = "https://github.com/togglebyte/anathema"
1212
repository = "https://github.com/togglebyte/anathema"
1313
publish = true
14+
rust-version = "1.88"
1415

1516
[dependencies]
1617
anathema-backend = { workspace = true }
@@ -39,24 +40,24 @@ workspace = true
3940

4041
[workspace.package]
4142
edition = "2024"
42-
version = "0.2.9"
43+
version = "0.2.10"
4344

4445
[workspace.dependencies]
4546
bitflags = "2.4.1"
4647
crossterm = "0.28.1"
4748
unicode-width = "0.1.11"
4849
flume = "0.11.0"
4950
notify = "6.1.1"
50-
anathema-default-widgets = { path = "./anathema-default-widgets", version = "0.2.9" }
51-
anathema-backend = { path = "./anathema-backend", version = "0.2.9" }
52-
anathema-runtime = { path = "./anathema-runtime", version = "0.2.9" }
53-
anathema-state = { path = "./anathema-state", version = "0.2.9" }
54-
anathema-state-derive = { path = "./anathema-state-derive", version = "0.2.9" }
55-
anathema-store = { path = "./anathema-store", version = "0.2.9" }
56-
anathema-templates = { path = "./anathema-templates", version = "0.2.9" }
57-
anathema-widgets = { path = "./anathema-widgets", version = "0.2.9" }
58-
anathema-geometry = { path = "./anathema-geometry", version = "0.2.9" }
59-
anathema-value-resolver = { path = "./anathema-value-resolver", version = "0.2.9" }
51+
anathema-default-widgets = { path = "./anathema-default-widgets", version = "0.2.10" }
52+
anathema-backend = { path = "./anathema-backend", version = "0.2.10" }
53+
anathema-runtime = { path = "./anathema-runtime", version = "0.2.10" }
54+
anathema-state = { path = "./anathema-state", version = "0.2.10" }
55+
anathema-state-derive = { path = "./anathema-state-derive", version = "0.2.10" }
56+
anathema-store = { path = "./anathema-store", version = "0.2.10" }
57+
anathema-templates = { path = "./anathema-templates", version = "0.2.10" }
58+
anathema-widgets = { path = "./anathema-widgets", version = "0.2.10" }
59+
anathema-geometry = { path = "./anathema-geometry", version = "0.2.10" }
60+
anathema-value-resolver = { path = "./anathema-value-resolver", version = "0.2.10" }
6061

6162
[workspace]
6263
members = [
@@ -83,6 +84,7 @@ should_implement_trait = "allow"
8384
type_complexity = "allow"
8485
too_many_arguments = "allow"
8586
wrong_self_convention = "allow"
87+
collapsible_if = "allow"
8688

8789
[package.metadata.release]
8890
shared-version = true

anathema-default-widgets/src/layout/expand.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,14 @@ pub fn layout_all_expansions<'bp>(
8585
let mut constraints = Constraints::new(sub_size, constraints.max_height());
8686

8787
// Ensure that the rounding doesn't push the constraint outside of the max width
88-
constraints.min_width = constraints.max_width();
88+
constraints.min_width = constraints.min_width.min(constraints.max_width());
8989
constraints
9090
}
9191
Axis::Vertical => {
9292
let mut constraints = Constraints::new(constraints.max_width(), sub_size);
9393

9494
// Ensure that the rounding doesn't push the constraint outside of the max height
95-
constraints.min_height = constraints.max_height();
95+
constraints.min_height = constraints.min_height.min(constraints.max_height());
9696
constraints
9797
}
9898
};

anathema-geometry/src/region.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ impl Region {
4949
}
5050

5151
/// Check if a region contains a position.
52-
/// Regions are inclusive, so a region from 0,0 to 10, 10 contains both Pos::ZERO and
53-
/// Pos::New(10, 10)
52+
/// Regions are exclusive, so a region from 0,0 to 10, 10 contains `Pos::ZERO`
53+
/// but not `Pos::New(10, 10)`
5454
pub const fn contains(&self, pos: Pos) -> bool {
5555
pos.x >= self.from.x && pos.x < self.to.x && pos.y >= self.from.y && pos.y < self.to.y
5656
}

anathema-runtime/src/runtime/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,21 +385,21 @@ impl<'rt, 'bp, G: GlobalEventHandler> Frame<'rt, 'bp, G> {
385385
puffin::GlobalProfiler::lock().new_frame();
386386

387387
let now = Instant::now();
388-
self.init_new_components();
389388
let elapsed = self.handle_messages(now);
390389
self.poll_events(elapsed, now, backend);
391390
self.drain_deferred_commands();
392391
self.drain_assoc_events();
392+
self.tick_components(self.dt.elapsed());
393393

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

400-
self.tick_components(self.dt.elapsed());
401400
self.cycle(backend)?;
402401

402+
self.init_new_components();
403403
self.post_cycle_events();
404404

405405
*self.dt = Instant::now();

anathema-testutils/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ homepage = "https://github.com/togglebyte/anathema"
99
repository = "https://github.com/togglebyte/anathema"
1010

1111
[dependencies]
12-
anathema = { path = "../", version = "0.2.9" }
12+
anathema = { path = "../", version = "0.2.10" }
1313

1414
[lints]
1515
workspace = true

anathema-widgets/src/nodes/eval.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,7 @@ impl Evaluator for ComponentEval {
303303
.ok_or_else(|| ctx.error(ErrorKind::TreeTransactionFailed))?;
304304
ctx.new_components.push((widget_id, state_id));
305305

306-
let path = tree.path(widget_id);
307-
ctx.components
308-
.push(path, component_id, widget_id, state_id, accept_ticks);
306+
ctx.components.push(component_id, widget_id, state_id, accept_ticks);
309307

310308
Ok(())
311309
}

anathema-widgets/src/widget/mod.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use std::any::Any;
2-
use std::cmp::Ordering;
32
use std::fmt::{self, Debug};
43
use std::ops::ControlFlow;
54

@@ -39,27 +38,6 @@ pub struct CompEntry {
3938
pub accept_ticks: bool,
4039

4140
component_id: ComponentBlueprintId,
42-
path: Box<[u16]>,
43-
}
44-
45-
impl PartialOrd for CompEntry {
46-
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
47-
Some(self.path.cmp(&other.path))
48-
}
49-
}
50-
51-
impl Ord for CompEntry {
52-
fn cmp(&self, other: &Self) -> Ordering {
53-
self.path.cmp(&other.path)
54-
}
55-
}
56-
57-
impl Eq for CompEntry {}
58-
59-
impl PartialEq for CompEntry {
60-
fn eq(&self, other: &Self) -> bool {
61-
self.path.eq(&other.path)
62-
}
6341
}
6442

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

7553
pub fn push(
7654
&mut self,
77-
path: Box<[u16]>,
7855
component_id: ComponentBlueprintId,
7956
widget_id: WidgetId,
8057
state_id: StateId,
8158
accept_ticks: bool,
8259
) {
8360
let entry = CompEntry {
84-
path,
8561
component_id,
8662
widget_id,
8763
state_id,

0 commit comments

Comments
 (0)