@@ -19,6 +19,7 @@ var txtStdout *tview.TextView
19
19
var txtStderr * tview.TextView
20
20
var UIselectedConfigPath string
21
21
var UItmpConfigPath string
22
+ var currentSelector int = 1
22
23
23
24
func InitUI () {
24
25
UIapp = tview .NewApplication ()
@@ -37,6 +38,14 @@ func MainWindow() {
37
38
SetText (RenderFastfinderVersion ()).
38
39
SetTextAlign (tview .AlignCenter )
39
40
41
+ /*
42
+ * TEXTVIEW : selection box helper
43
+ */
44
+ txtInfoTitle := tview .NewTextView ().
45
+ SetDynamicColors (true ).
46
+ SetText ("Press tab to navigate between log box | Up and Down arrow to scroll" ).
47
+ SetTextAlign (tview .AlignCenter )
48
+
40
49
/*
41
50
* TEXTVIEW : File matchs
42
51
*/
@@ -59,9 +68,9 @@ func MainWindow() {
59
68
UIapp .Draw ()
60
69
})
61
70
62
- /*
63
- * TEXTVIEW : execution errors
64
- */
71
+ /*
72
+ * TEXTVIEW : execution errors
73
+ */
65
74
txtStderr .
66
75
SetDynamicColors (true ).
67
76
SetText ("[red]Access and scan errors:\n " ).
@@ -73,11 +82,33 @@ func MainWindow() {
73
82
/*
74
83
* Building window
75
84
*/
76
- grid := tview .NewGrid ().SetRows (1 , - 5 , - 2 ).SetColumns (0 , 0 ).SetBorders (true )
85
+ grid := tview .NewGrid ().SetRows (1 , - 5 , - 2 , 1 ).SetColumns (0 , 0 ).SetBorders (true )
77
86
grid .AddItem (txtAppTitle , 0 , 0 , 1 , 2 , 0 , 0 , false )
78
87
grid .AddItem (txtMatchs , 1 , 1 , 1 , 1 , 0 , 0 , false )
79
88
grid .AddItem (txtStderr , 1 , 0 , 1 , 1 , 0 , 0 , false )
80
89
grid .AddItem (txtStdout , 2 , 0 , 1 , 2 , 0 , 0 , false )
90
+ grid .AddItem (txtInfoTitle , 3 , 0 , 1 , 2 , 0 , 0 , false )
91
+
92
+ grid .SetInputCapture (func (event * tcell.EventKey ) * tcell.EventKey {
93
+ if event .Key () == tcell .KeyTab {
94
+ switch currentSelector {
95
+ case 1 :
96
+ currentSelector ++
97
+ UIapp .SetFocus (txtStdout )
98
+ txtInfoTitle .SetText ("Selected box: Informations messages" )
99
+ case 2 :
100
+ currentSelector ++
101
+ UIapp .SetFocus (txtStderr )
102
+ txtInfoTitle .SetText ("Selected box: Error messages" )
103
+ case 3 :
104
+ currentSelector = 1
105
+ UIapp .SetFocus (txtMatchs )
106
+ txtInfoTitle .SetText ("Selected box: Matchs messages" )
107
+ }
108
+ return nil
109
+ }
110
+ return event
111
+ })
81
112
82
113
AppStarted = true
83
114
if err := UIapp .SetRoot (grid , true ).SetFocus (txtMatchs ).Run (); err != nil {
0 commit comments