Skip to content

Commit 88f0864

Browse files
committed
fix: adjust bubble tail calculation to account for leading space in render script and tests
1 parent 0d293e4 commit 88f0864

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

lib/render.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ for l in "${LINES[@]+"${LINES[@]}"}"; do
4444
done
4545

4646
# Bubble tail ┬ lands at the center of the center column (0-indexed TAIL_COL).
47-
# Formula: CHAR_SIDE_WIDTH + CHAR_CENTER_WIDTH/2. Default 5+4=9 → LEFT_DASHES=8.
47+
# Formula: CHAR_SIDE_WIDTH + CHAR_CENTER_WIDTH/2. Default 5+4=9 → LEFT_DASHES=7.
48+
# Bubble lines have a leading space before ╰, so LEFT_DASHES = TAIL_COL - 2.
4849
_TAIL_COL=$(( ${CHAR_SIDE_WIDTH:-5} + (${CHAR_CENTER_WIDTH:-8} / 2) ))
49-
_LEFT_DASHES=$(( _TAIL_COL - 1 ))
50+
_LEFT_DASHES=$(( _TAIL_COL - 2 ))
5051
_MIN_INNER=$(( _LEFT_DASHES + 2 )) # guarantees at least 1 dash right of junction
5152
INNER=$(( MAX + 2 < _MIN_INNER ? _MIN_INNER : MAX + 2 ))
5253
TOP_BORDER=$(printf '─%.0s' $(seq 1 $INNER))

tests/test-render.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ render() { bash "$PLUGIN_ROOT/lib/render.sh" "$@"; }
1414

1515
# Compute expected bubble tail strings from dimension vars.
1616
_tail_col=$(( ${CHAR_SIDE_WIDTH:-5} + (${CHAR_CENTER_WIDTH:-8} / 2) ))
17-
_left_dashes=$(( _tail_col - 1 ))
17+
_left_dashes=$(( _tail_col - 2 ))
1818
_left_str=$(printf '─%.0s' $(seq 1 $_left_dashes))
1919
_expected_tail="${_left_str}"
2020
_expected_short_bottom="${_left_str}┬─╯"

0 commit comments

Comments
 (0)