| 1 |
Descriptionscip-debian debian hx 25.07.1+20260624+ds+~0.3.3+ds+~0.4.0+20260607+ds-4 hx/patches/`1003_replace_cassowary_kasuari.patch`#Description.: use crate kasuari (not abandoned cassowary) |
| 2 |
Authorscip-debian debian hx 25.07.1+20260624+ds+~0.3.3+ds+~0.4.0+20260607+ds-4 hx/patches/`1003_replace_cassowary_kasuari.patch`#Author.: Jonas Smedegaard <[email protected]scip-debian . . . identity/`[email protected]`.> |
| 3 |
Bug-Debianscip-debian debian hx 25.07.1+20260624+ds+~0.3.3+ds+~0.4.0+20260607+ds-4 hx/patches/`1003_replace_cassowary_kasuari.patch`#Bug-Debian.: https://bugs.debian.org/1129372scip-debian-bts debian-bts . . 1129372: |
| 4 |
Last-Updatescip-debian debian hx 25.07.1+20260624+ds+~0.3.3+ds+~0.4.0+20260607+ds-4 hx/patches/`1003_replace_cassowary_kasuari.patch`#Last-Update.: 2026-04-08 |
| 5 |
--- |
| 6 |
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ |
| 7 |
--- a/helix-tui/Cargo.tomlscip-debian debian hx 25.07.1+20260624+ds+~0.3.3+ds+~0.4.0+20260607+ds-4 hx/upstream/`helix-tui/Cargo.toml`: |
| 8 |
+++ b/helix-tui/Cargo.tomlscip-debian debian hx 25.07.1+20260624+ds+~0.3.3+ds+~0.4.0+20260607+ds-4 hx/upstream/`helix-tui/Cargo.toml`: |
| 9 |
@@ -19,7 +19,7 @@ |
| 10 |
helix-core = { path = "../helix-core" } |
| 11 |
|
| 12 |
bitflags.workspace = true |
| 13 |
|
| 14 |
+kasuari = "0.4" |
| 15 |
arrayvec.workspace = true |
| 16 |
unicode-segmentation.workspace = true |
| 17 |
termina = { workspace = true, optional = true } |
| 18 |
--- a/helix-tui/src/layout.rsscip-debian debian hx 25.07.1+20260624+ds+~0.3.3+ds+~0.4.0+20260607+ds-4 hx/upstream/`helix-tui/src/layout.rs`: |
| 19 |
+++ b/helix-tui/src/layout.rsscip-debian debian hx 25.07.1+20260624+ds+~0.3.3+ds+~0.4.0+20260607+ds-4 hx/upstream/`helix-tui/src/layout.rs`: |
| 20 |
@@ -3,9 +3,9 @@ |
| 21 |
use std::cell::RefCell; |
| 22 |
use std::collections::HashMap; |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
+use kasuari::Strength; |
| 28 |
+use kasuari::WeightedRelation::*; |
| 29 |
+use kasuari::{Constraint as KasuariConstraint, Expression, Solver, Variable}; |
| 30 |
|
| 31 |
use helix_view::graphics::{Margin, Rect}; |
| 32 |
|
| 33 |
@@ -208,75 +208,75 @@ |
| 34 |
vars.insert(e.width, (i, 2)); |
| 35 |
vars.insert(e.height, (i, 3)); |
| 36 |
} |
| 37 |
|
| 38 |
+ let mut ccs: Vec<KasuariConstraint> = |
| 39 |
Vec::with_capacity(elements.len() * 4 + layout.constraints.len() * 6); |
| 40 |
for elt in &elements { |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
+ ccs.push(elt.width | GE(Strength::REQUIRED) | 0f64); |
| 48 |
+ ccs.push(elt.height | GE(Strength::REQUIRED) | 0f64); |
| 49 |
+ ccs.push(elt.left() | GE(Strength::REQUIRED) | f64::from(dest_area.left())); |
| 50 |
+ ccs.push(elt.top() | GE(Strength::REQUIRED) | f64::from(dest_area.top())); |
| 51 |
+ ccs.push(elt.right() | LE(Strength::REQUIRED) | f64::from(dest_area.right())); |
| 52 |
+ ccs.push(elt.bottom() | LE(Strength::REQUIRED) | f64::from(dest_area.bottom())); |
| 53 |
} |
| 54 |
if let Some(first) = elements.first() { |
| 55 |
ccs.push(match layout.direction { |
| 56 |
|
| 57 |
|
| 58 |
+ Direction::Horizontal => first.left() | EQ(Strength::REQUIRED) | f64::from(dest_area.left()), |
| 59 |
+ Direction::Vertical => first.top() | EQ(Strength::REQUIRED) | f64::from(dest_area.top()), |
| 60 |
}); |
| 61 |
} |
| 62 |
if let Some(last) = elements.last() { |
| 63 |
ccs.push(match layout.direction { |
| 64 |
|
| 65 |
|
| 66 |
+ Direction::Horizontal => last.right() | EQ(Strength::REQUIRED) | f64::from(dest_area.right()), |
| 67 |
+ Direction::Vertical => last.bottom() | EQ(Strength::REQUIRED) | f64::from(dest_area.bottom()), |
| 68 |
}); |
| 69 |
} |
| 70 |
match layout.direction { |
| 71 |
Direction::Horizontal => { |
| 72 |
for pair in elements.windows(2) { |
| 73 |
|
| 74 |
+ ccs.push((pair[0].x + pair[0].width) | EQ(Strength::REQUIRED) | pair[1].x); |
| 75 |
} |
| 76 |
for (i, size) in layout.constraints.iter().enumerate() { |
| 77 |
|
| 78 |
|
| 79 |
+ ccs.push(elements[i].y | EQ(Strength::REQUIRED) | f64::from(dest_area.y)); |
| 80 |
+ ccs.push(elements[i].height | EQ(Strength::REQUIRED) | f64::from(dest_area.height)); |
| 81 |
ccs.push(match *size { |
| 82 |
|
| 83 |
+ Constraint::Length(v) => elements[i].width | EQ(Strength::WEAK) | f64::from(v), |
| 84 |
Constraint::Percentage(v) => { |
| 85 |
|
| 86 |
+ elements[i].width | EQ(Strength::WEAK) | (f64::from(v * dest_area.width) / 100.0) |
| 87 |
} |
| 88 |
Constraint::Ratio(n, d) => { |
| 89 |
elements[i].width |
| 90 |
|
| 91 |
+ | EQ(Strength::WEAK) |
| 92 |
| (f64::from(dest_area.width) * f64::from(n) / f64::from(d)) |
| 93 |
} |
| 94 |
|
| 95 |
|
| 96 |
+ Constraint::Min(v) => elements[i].width | GE(Strength::WEAK) | f64::from(v), |
| 97 |
+ Constraint::Max(v) => elements[i].width | LE(Strength::WEAK) | f64::from(v), |
| 98 |
}); |
| 99 |
} |
| 100 |
} |
| 101 |
Direction::Vertical => { |
| 102 |
for pair in elements.windows(2) { |
| 103 |
|
| 104 |
+ ccs.push((pair[0].y + pair[0].height) | EQ(Strength::REQUIRED) | pair[1].y); |
| 105 |
} |
| 106 |
for (i, size) in layout.constraints.iter().enumerate() { |
| 107 |
|
| 108 |
|
| 109 |
+ ccs.push(elements[i].x | EQ(Strength::REQUIRED) | f64::from(dest_area.x)); |
| 110 |
+ ccs.push(elements[i].width | EQ(Strength::REQUIRED) | f64::from(dest_area.width)); |
| 111 |
ccs.push(match *size { |
| 112 |
|
| 113 |
+ Constraint::Length(v) => elements[i].height | EQ(Strength::WEAK) | f64::from(v), |
| 114 |
Constraint::Percentage(v) => { |
| 115 |
|
| 116 |
+ elements[i].height | EQ(Strength::WEAK) | (f64::from(v * dest_area.height) / 100.0) |
| 117 |
} |
| 118 |
Constraint::Ratio(n, d) => { |
| 119 |
elements[i].height |
| 120 |
|
| 121 |
+ | EQ(Strength::WEAK) |
| 122 |
| (f64::from(dest_area.height) * f64::from(n) / f64::from(d)) |
| 123 |
} |
| 124 |
|
| 125 |
|
| 126 |
+ Constraint::Min(v) => elements[i].height | GE(Strength::WEAK) | f64::from(v), |
| 127 |
+ Constraint::Max(v) => elements[i].height | LE(Strength::WEAK) | f64::from(v), |
| 128 |
}); |
| 129 |
} |
| 130 |
} |
| 131 |
} |
| 132 |
|
| 133 |
+ solver.add_constraints(ccs).unwrap(); |
| 134 |
for &(var, value) in solver.fetch_changes() { |
| 135 |
let (index, attr) = vars[&var]; |
| 136 |
let value = if value.is_sign_negative() { |