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

Function RunTUI

pkg/integration/clients/tui.go:25–195  ·  view source on GitHub ↗
(raceDetector bool)

Source from the content-addressed store, hash-verified

23var SLOW_INPUT_DELAY = 600
24
25func RunTUI(raceDetector bool) {
26 rootDir := utils.GetLazyRootDirectory()
27 testDir := filepath.Join(rootDir, "test", "integration")
28
29 app := newApp(testDir)
30 app.loadTests()
31
32 g, err := gocui.NewGui(gocui.NewGuiOpts{
33 OutputMode: gocui.OutputTrue,
34 RuneReplacements: gui.RuneReplacements,
35 })
36 if err != nil {
37 log.Panicln(err)
38 }
39
40 g.Cursor = false
41
42 app.g = g
43
44 g.SetManagerFunc(app.layout)
45
46 g.SetKeybinding("list", gocui.NewKeyName(gocui.KeyArrowUp), func(*gocui.Gui, *gocui.View) error {
47 if app.itemIdx > 0 {
48 app.itemIdx--
49 }
50 listView, err := g.View("list")
51 if err != nil {
52 return err
53 }
54 listView.FocusPoint(0, app.itemIdx, true)
55 return nil
56 })
57
58 g.SetKeybinding("list", gocui.NewKeyName(gocui.KeyArrowDown), func(*gocui.Gui, *gocui.View) error {
59 if app.itemIdx < len(app.filteredTests)-1 {
60 app.itemIdx++
61 }
62
63 listView, err := g.View("list")
64 if err != nil {
65 return err
66 }
67 listView.FocusPoint(0, app.itemIdx, true)
68 return nil
69 })
70
71 g.SetKeybinding("list", gocui.NewKeyStrMod("c", gocui.ModCtrl), quit)
72
73 g.SetKeybinding("list", gocui.NewKeyRune('q'), quit)
74
75 g.SetKeybinding("list", gocui.NewKeyRune('s'), func(*gocui.Gui, *gocui.View) error {
76 currentTest := app.getCurrentTest()
77 if currentTest == nil {
78 return nil
79 }
80
81 suspendAndRunTest(currentTest, true, false, raceDetector, 0)
82

Callers 1

mainFunction · 0.92

Calls 15

SetManagerFuncMethod · 0.95
SetKeybindingMethod · 0.95
ViewMethod · 0.95
SetCurrentViewMethod · 0.95
MainLoopMethod · 0.95
CloseMethod · 0.95
NewGuiFunction · 0.92
NewKeyNameFunction · 0.92
NewKeyStrModFunction · 0.92
NewKeyRuneFunction · 0.92
newAppFunction · 0.85
suspendAndRunTestFunction · 0.85

Tested by

no test coverage detected