Render ┄ ┅ ┆ ┇ ┈ ┉ ┊ ┋ with spaces at the edges

Matches rendering in most other programs and allows long chains of them to look better

Fixes #3844
This commit is contained in:
Kovid Goyal
2021-07-19 13:41:52 +05:30
parent d912d96f00
commit 1f35694705
2 changed files with 14 additions and 10 deletions

View File

@@ -39,6 +39,10 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- A new theme for the kitty website with support for dark mode.
- Render the ┄ ┅ ┆ ┇ ┈ ┉ ┊ ┋ with spaces at the edges. Matches rendering in
most other programs and allows long chains of them to look better
(:iss:`3844`)
0.21.2 [2021-06-28]
----------------------

View File

@@ -60,17 +60,17 @@ def half_vline(buf: BufType, width: int, height: int, level: int = 1, which: str
def get_holes(sz: int, hole_sz: int, num: int) -> List[Tuple[int, ...]]:
if num == 1:
pts = [sz // 2]
elif num == 2:
ssz = (sz - 2 * hole_sz) // 3
pts = [ssz + hole_sz // 2, 2 * ssz + hole_sz // 2 + hole_sz]
elif num == 3:
ssz = (sz - 3 * hole_sz) // 4
pts = [ssz + hole_sz // 2, 2 * ssz + hole_sz // 2 + hole_sz, 3 * ssz + 2 * hole_sz + hole_sz // 2]
all_holes_use = (num + 1) * hole_sz
individual_block_size = (sz - all_holes_use) // (num + 1)
half_hole_sz = hole_sz // 2
pos = - half_hole_sz
holes = []
for c in pts:
holes.append(tuple(range(c - hole_sz // 2, c - hole_sz // 2 + hole_sz)))
while pos < sz:
left = max(0, pos)
right = min(sz, pos + hole_sz)
if right > left:
holes.append(tuple(range(left, right)))
pos = right + individual_block_size
return holes