MCPcopy Create free account
hub / github.com/gokcehan/lf / drawBox

Method drawBox

ui.go:1044–1095  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1042}
1043
1044func (ui *ui) drawBox() {
1045 st := parseEscapeSequence(gOpts.borderfmt)
1046
1047 w, h := ui.screen.Size()
1048 style := gOpts.borderstyle
1049
1050 if style&borderOutline != 0 {
1051 for i := 1; i < w-1; i++ {
1052 ui.screen.PutStrStyled(i, 1, string(tcell.RuneHLine), st)
1053 ui.screen.PutStrStyled(i, h-2, string(tcell.RuneHLine), st)
1054 }
1055
1056 for i := 2; i < h-2; i++ {
1057 ui.screen.PutStrStyled(0, i, string(tcell.RuneVLine), st)
1058 ui.screen.PutStrStyled(w-1, i, string(tcell.RuneVLine), st)
1059 }
1060
1061 if style&borderRound != 0 {
1062 ui.screen.PutStrStyled(0, 1, "╭", st)
1063 ui.screen.PutStrStyled(w-1, 1, "╮", st)
1064 ui.screen.PutStrStyled(0, h-2, "╰", st)
1065 ui.screen.PutStrStyled(w-1, h-2, "╯", st)
1066 } else {
1067 ui.screen.PutStrStyled(0, 1, string(tcell.RuneULCorner), st)
1068 ui.screen.PutStrStyled(w-1, 1, string(tcell.RuneURCorner), st)
1069 ui.screen.PutStrStyled(0, h-2, string(tcell.RuneLLCorner), st)
1070 ui.screen.PutStrStyled(w-1, h-2, string(tcell.RuneLRCorner), st)
1071 }
1072 }
1073
1074 if style&borderSeparators == 0 {
1075 return
1076 }
1077
1078 top, bot := 1, h-1
1079 if style&borderOutline != 0 {
1080 top, bot = 2, h-2
1081 }
1082
1083 for wind := range len(ui.wins) - 1 {
1084 x := ui.wins[wind].x + ui.wins[wind].w
1085 if style&borderOutline != 0 {
1086 ui.screen.PutStrStyled(x, 1, string(tcell.RuneTTee), st)
1087 }
1088 for y := top; y < bot; y++ {
1089 ui.screen.PutStrStyled(x, y, string(tcell.RuneVLine), st)
1090 }
1091 if style&borderOutline != 0 {
1092 ui.screen.PutStrStyled(x, h-2, string(tcell.RuneBTee), st)
1093 }
1094 }
1095}
1096
1097func (ui *ui) drawMenu() {
1098 if ui.menu == "" {

Callers 1

drawMethod · 0.95

Calls 2

parseEscapeSequenceFunction · 0.85
SizeMethod · 0.45

Tested by

no test coverage detected