@@ -139,7 +139,7 @@ func (lk *LogKeyboard) PrintKeyboardInfo(print func()) {
139
139
print ()
140
140
141
141
if lk .logLevel == INFO {
142
- lk .createBuffer (1 )
142
+ lk .createBuffer (0 )
143
143
lk .printNavigationMenu ()
144
144
}
145
145
}
@@ -148,18 +148,16 @@ func (lk *LogKeyboard) PrintKeyboardInfo(print func()) {
148
148
func (lk * LogKeyboard ) createBuffer (lines int ) {
149
149
allocateSpace (lines )
150
150
151
- if lk .kError .shoudlDisplay () && isOverflow ( lk . kError . error ()) {
151
+ if lk .kError .shoudlDisplay () {
152
152
extraLines := linesOffset (lk .kError .error ()) + 1
153
153
allocateSpace (extraLines )
154
154
lines = lines + extraLines
155
155
}
156
156
157
157
infoMessage := lk .navigationMenu ()
158
- if isOverflow (infoMessage ) {
159
- extraLines := linesOffset (infoMessage ) + 1
160
- allocateSpace (extraLines )
161
- lines = lines + extraLines
162
- }
158
+ extraLines := linesOffset (infoMessage ) + 1
159
+ allocateSpace (extraLines )
160
+ lines = lines + extraLines
163
161
164
162
if lines > 0 {
165
163
MoveCursorUp (lines )
@@ -272,7 +270,10 @@ func (lk *LogKeyboard) HandleKeyEvents(event keyboard.KeyEvent, ctx context.Cont
272
270
switch key := event .Key ; key {
273
271
case keyboard .KeyCtrlC :
274
272
keyboard .Close ()
273
+
275
274
lk .clearNavigationMenu ()
275
+ ShowCursor ()
276
+
276
277
lk .logLevel = NONE
277
278
if lk .Watch .Watching && lk .Watch .Cancel != nil {
278
279
lk .Watch .Cancel ()
@@ -285,7 +286,6 @@ func (lk *LogKeyboard) HandleKeyEvents(event keyboard.KeyEvent, ctx context.Cont
285
286
return nil
286
287
})(ctx )
287
288
}()
288
- ShowCursor ()
289
289
// will notify main thread to kill and will handle gracefully
290
290
lk .signalChannel <- syscall .SIGINT
291
291
case keyboard .KeyEnter :
@@ -303,10 +303,6 @@ func allocateSpace(lines int) {
303
303
}
304
304
}
305
305
306
- func isOverflow (s string ) bool {
307
- return lenAnsi (s ) > goterm .Width ()
308
- }
309
-
310
306
func linesOffset (s string ) int {
311
307
return int (math .Floor (float64 (lenAnsi (s )) / float64 (goterm .Width ())))
312
308
}
0 commit comments