MCPcopy
hub / github.com/jesseduffield/lazygit / draw

Method draw

pkg/gocui/gui.go:1228–1297  ·  view source on GitHub ↗

draw manages the cursor and calls the draw function of a view.

(v *View)

Source from the content-addressed store, hash-verified

1226
1227// draw manages the cursor and calls the draw function of a view.
1228func (g *Gui) draw(v *View) error {
1229 if g.suspended {
1230 return nil
1231 }
1232
1233 if !v.Visible || v.y1 < v.y0 || v.x1 < v.x0 {
1234 return nil
1235 }
1236
1237 if g.Cursor {
1238 if curview := g.currentView; curview != nil {
1239 vMaxX, vMaxY := curview.InnerSize()
1240 if curview.cx >= 0 && curview.cx < vMaxX && curview.cy >= 0 && curview.cy < vMaxY {
1241 cx, cy := curview.x0+curview.cx+1, curview.y0+curview.cy+1
1242 Screen.ShowCursor(cx, cy)
1243 } else {
1244 Screen.HideCursor()
1245 }
1246 }
1247 } else {
1248 Screen.HideCursor()
1249 }
1250
1251 v.draw()
1252
1253 if v.Frame {
1254 var fgColor, bgColor, frameColor Attribute
1255 if g.Highlight && v == g.currentView {
1256 fgColor = g.SelFgColor
1257 bgColor = g.SelBgColor
1258 frameColor = g.SelFrameColor
1259 } else {
1260 bgColor = g.BgColor
1261 if v.TitleColor != ColorDefault {
1262 fgColor = v.TitleColor
1263 } else {
1264 fgColor = g.FgColor
1265 }
1266 if v.FrameColor != ColorDefault {
1267 frameColor = v.FrameColor
1268 } else {
1269 frameColor = g.FrameColor
1270 }
1271 }
1272
1273 if err := g.drawFrameEdges(v, frameColor, bgColor); err != nil {
1274 return err
1275 }
1276 if err := g.drawFrameCorners(v, frameColor, bgColor); err != nil {
1277 return err
1278 }
1279 if v.Title != "" || len(v.Tabs) > 0 {
1280 if err := g.drawTitle(v, fgColor, bgColor); err != nil {
1281 return err
1282 }
1283 }
1284 if v.Subtitle != "" {
1285 if err := g.drawSubtitle(v, fgColor, bgColor); err != nil {

Callers 2

flushMethod · 0.95
flushContentOnlyMethod · 0.95

Calls 6

drawFrameEdgesMethod · 0.95
drawFrameCornersMethod · 0.95
drawTitleMethod · 0.95
drawSubtitleMethod · 0.95
drawListFooterMethod · 0.95
InnerSizeMethod · 0.80

Tested by

no test coverage detected