Skip to content

Commit 9eba84f

Browse files
committed
Fixed the rest of the corner logic
This was annoying
1 parent 8799f97 commit 9eba84f

1 file changed

Lines changed: 22 additions & 7 deletions

File tree

asyncgit/src/graph/walker.rs

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,14 @@ impl GraphWalker {
181181
);
182182

183183
if let Some((from, to)) = merge_bridge {
184+
let target_lane =
185+
if from == commit_lane { to } else { from };
184186
Self::draw_bridge(
185187
&mut lanes,
186188
from,
187189
to,
188190
commit_lane,
191+
target_lane,
189192
ConnType::MergeBridgeMid,
190193
ConnType::MergeBridgeStart,
191194
ConnType::MergeBridgeEnd,
@@ -207,6 +210,7 @@ impl GraphWalker {
207210
from,
208211
to,
209212
branch_lane,
213+
branch_lane,
210214
ConnType::MergeBridgeMid,
211215
ConnType::BranchUp,
212216
ConnType::BranchUpRight,
@@ -287,18 +291,29 @@ impl GraphWalker {
287291
from: usize,
288292
to: usize,
289293
color_lane: usize,
294+
corner_lane: usize,
290295
mid: ConnType,
291-
start: ConnType,
292-
end: ConnType,
296+
corner_right: ConnType,
297+
corner_left: ConnType,
293298
) {
294299
for lane in lanes.iter_mut().take(to).skip(from + 1) {
295-
*lane = Some((mid, color_lane % 16));
300+
match lane {
301+
Some((
302+
ConnType::Vertical | ConnType::VerticalDotted,
303+
_,
304+
)) => {
305+
*lane = Some((ConnType::Cross, color_lane % 16));
306+
}
307+
_ => {
308+
*lane = Some((mid, color_lane % 16));
309+
}
310+
}
296311
}
297312

298-
if to > color_lane {
299-
lanes[to] = Some((start, color_lane % 16));
300-
} else if from < color_lane {
301-
lanes[from] = Some((end, color_lane % 16));
313+
if corner_lane == to {
314+
lanes[to] = Some((corner_right, color_lane % 16));
315+
} else if corner_lane == from {
316+
lanes[from] = Some((corner_left, color_lane % 16));
302317
}
303318
}
304319
}

0 commit comments

Comments
 (0)