Skip to content
Myr

Update tcell renderer to support block border

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Junegunn Choi · committed by Junegunn Choi · parent 607eacf · Browse files · 1 file+11 added−11 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+11 added−11 removed

  • other:+11 added−11 removed

1 file+11 added−11 removed

modified:src/tui/tcell.go+11 added-11 removed
705 unmodified lines
706 } else {707 style = w.normal.style()708 }709710 hw := runewidth.RuneWidth(w.borderStyle.horizontal)710 hw := runewidth.RuneWidth(w.borderStyle.top)711 switch shape {712 case BorderRounded, BorderSharp, BorderBold, BorderDouble, BorderHorizontal, BorderTop:712 case BorderRounded, BorderSharp, BorderBold, BorderBlock, BorderDouble, BorderHorizontal, BorderTop:713 max := right - 2*hw714 if shape == BorderHorizontal || shape == BorderTop {715 max = right - hw716 }
2 unmodified lines
719 // SetContent( TR )720 // ==================721 // ( HH ) => TR is ignored722 for x := left; x <= max; x += hw {723 _screen.SetContent(x, top, w.borderStyle.horizontal, nil, style)723 _screen.SetContent(x, top, w.borderStyle.top, nil, style)724 }725 }726 switch shape {727 case BorderRounded, BorderSharp, BorderBold, BorderDouble, BorderHorizontal, BorderBottom:727 case BorderRounded, BorderSharp, BorderBold, BorderBlock, BorderDouble, BorderHorizontal, BorderBottom:728 max := right - 2*hw729 if shape == BorderHorizontal || shape == BorderBottom {730 max = right - hw731 }732 for x := left; x <= max; x += hw {733 _screen.SetContent(x, bot-1, w.borderStyle.horizontal, nil, style)733 _screen.SetContent(x, bot-1, w.borderStyle.bottom, nil, style)734 }735 }736 if !onlyHorizontal {737 switch shape {738 case BorderRounded, BorderSharp, BorderBold, BorderDouble, BorderVertical, BorderLeft:738 case BorderRounded, BorderSharp, BorderBold, BorderBlock, BorderDouble, BorderVertical, BorderLeft:739 for y := top; y < bot; y++ {740 _screen.SetContent(left, y, w.borderStyle.vertical, nil, style)740 _screen.SetContent(left, y, w.borderStyle.left, nil, style)741 }742 }743 switch shape {744 case BorderRounded, BorderSharp, BorderBold, BorderDouble, BorderVertical, BorderRight:745 vw := runewidth.RuneWidth(w.borderStyle.vertical)744 case BorderRounded, BorderSharp, BorderBold, BorderBlock, BorderDouble, BorderVertical, BorderRight:745 vw := runewidth.RuneWidth(w.borderStyle.right)746 for y := top; y < bot; y++ {747 _screen.SetContent(right-vw, y, w.borderStyle.vertical, nil, style)747 _screen.SetContent(right-vw, y, w.borderStyle.right, nil, style)748 }749 }750 }751 switch shape {752 case BorderRounded, BorderSharp, BorderBold, BorderDouble:752 case BorderRounded, BorderSharp, BorderBold, BorderBlock, BorderDouble:753 _screen.SetContent(left, top, w.borderStyle.topLeft, nil, style)754 _screen.SetContent(right-runewidth.RuneWidth(w.borderStyle.topRight), top, w.borderStyle.topRight, nil, style)755 _screen.SetContent(left, bot-1, w.borderStyle.bottomLeft, nil, style)756 _screen.SetContent(right-runewidth.RuneWidth(w.borderStyle.bottomRight), bot-1, w.borderStyle.bottomRight, nil, style)
2 unmodified lines