Skip to content
Myr

Fix rendering of double-column borders

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 3109b86 · Browse files · 2 files+22 added−8 removed
This commit

State

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

Diff stats

2 files+22 added−8 removed

  • other:+22 added−8 removed

2 files+22 added−8 removed

modified:src/tui/tcell.go+17 added-3 removed
693 unmodified lines
694695 hw := runewidth.RuneWidth(w.borderStyle.horizontal)696 switch shape {697 case BorderRounded, BorderSharp, BorderBold, BorderDouble, BorderHorizontal, BorderTop:698 max := right - 2*hw699 if shape == BorderHorizontal || shape == BorderTop {700 max = right - hw701 }702 // tcell has an issue displaying two overlapping wide runes703 // e.g. SetContent( HH )704 // SetContent( TR )705 // ==================706 // ( HH ) => TR is ignored698 for x := left; x <= right-hw; x += hw {707 for x := left; x <= max; x += hw {708 _screen.SetContent(x, top, w.borderStyle.horizontal, nil, style)709 }710 }711 switch shape {712 case BorderRounded, BorderSharp, BorderBold, BorderDouble, BorderHorizontal, BorderBottom:713 max := right - 2*hw714 if shape == BorderHorizontal || shape == BorderBottom {715 max = right - hw716 }704 for x := left; x <= right-hw; x += hw {717 for x := left; x <= max; x += hw {718 _screen.SetContent(x, bot-1, w.borderStyle.horizontal, nil, style)719 }720 }721 switch shape {
3 unmodified lines
725 }726 }727 switch shape {728 case BorderRounded, BorderSharp, BorderBold, BorderDouble, BorderVertical, BorderRight:729 vw := runewidth.RuneWidth(w.borderStyle.vertical)730 for y := top; y < bot; y++ {717 _screen.SetContent(right-hw, y, w.borderStyle.vertical, nil, style)731 _screen.SetContent(right-vw, y, w.borderStyle.vertical, nil, style)732 }733 }734 switch shape {735 case BorderRounded, BorderSharp, BorderBold, BorderDouble:
6 unmodified lines
modified:src/terminal.go+5 added-5 removed
1062 unmodified lines
1063 }1064 // Reset preview version so that full redraw occurs1065 t.previewed.version = 010661067 bw := t.borderWidth1068 switch t.borderShape {1069 case tui.BorderHorizontal:1070 t.border = t.tui.NewWindow(1071 marginInt[0]-1, marginInt[3], width, height+2,1072 false, tui.MakeBorderStyle(tui.BorderHorizontal, t.unicode))1073 case tui.BorderVertical:1074 t.border = t.tui.NewWindow(1074 marginInt[0], marginInt[3]-2, width+4, height,1075 marginInt[0], marginInt[3]-(1+bw), width+(1+bw)*2, height,1076 false, tui.MakeBorderStyle(tui.BorderVertical, t.unicode))1077 case tui.BorderTop:1078 t.border = t.tui.NewWindow(1079 marginInt[0]-1, marginInt[3], width, height+1,
3 unmodified lines
1083 marginInt[0], marginInt[3], width, height+1,1084 false, tui.MakeBorderStyle(tui.BorderBottom, t.unicode))1085 case tui.BorderLeft:1086 t.border = t.tui.NewWindow(1086 marginInt[0], marginInt[3]-2, width+2, height,1087 marginInt[0], marginInt[3]-(1+bw), width+(1+bw), height,1088 false, tui.MakeBorderStyle(tui.BorderLeft, t.unicode))1089 case tui.BorderRight:1090 t.border = t.tui.NewWindow(1090 marginInt[0], marginInt[3], width+2, height,1091 marginInt[0], marginInt[3], width+(1+bw), height,1092 false, tui.MakeBorderStyle(tui.BorderRight, t.unicode))1093 case tui.BorderRounded, tui.BorderSharp, tui.BorderBold, tui.BorderDouble:1094 t.border = t.tui.NewWindow(1094 marginInt[0]-1, marginInt[3]-2, width+4, height+2,1095 marginInt[0]-1, marginInt[3]-(1+bw), width+(1+bw)*2, height+2,1096 false, tui.MakeBorderStyle(t.borderShape, t.unicode))1097 }10981099 // Add padding to margin
12 unmodified lines
1112 if previewOpts.size.size == 0 {1113 return1114 }1115 hasThreshold := previewOpts.threshold > 0 && previewOpts.alternative != nil1115 bw := t.borderWidth1116 createPreviewWindow := func(y int, x int, w int, h int) {1117 pwidth := w1118 pheight := h1119 var previewBorder tui.BorderStyle
2394 unmodified lines