@@ -69,7 +69,7 @@ func View(model tea.Model) string {
69
69
}
70
70
71
71
// check visible area
72
- height := m .Viewport .Height - 1 // TODO question: why -1, otherwise firstline gets cut of
72
+ height := m .Viewport .Height - 1 // TODO question: why does the first line get cut of, if i ommit the -1?
73
73
width := m .Viewport .Width
74
74
offset := m .visibleOffset
75
75
if height * width <= 0 {
@@ -209,6 +209,20 @@ out:
209
209
return holeString .String ()
210
210
}
211
211
212
+ // lineNumber returns line number of the given index
213
+ // and if relative is true the absolute difference to the curser
214
+ func lineNumber (relativ bool , curser , current int ) int {
215
+ if ! relativ || curser == current {
216
+ return current
217
+ }
218
+
219
+ diff := curser - current
220
+ if diff < 0 {
221
+ diff *= - 1
222
+ }
223
+ return diff
224
+ }
225
+
212
226
// Update changes the Model of the List according to the messages recieved
213
227
func Update (msg tea.Msg , m Model ) (Model , tea.Cmd ) {
214
228
var cmd tea.Cmd
@@ -393,17 +407,3 @@ func (m *Model) SetLess(less func(string, string) bool) {
393
407
func (m * Model ) Sort () {
394
408
sort .Sort (m )
395
409
}
396
-
397
- // lineNumber returns line number of the given index
398
- // and if relative is true the absolute difference to the curser
399
- func lineNumber (relativ bool , curser , current int ) int {
400
- if ! relativ || curser == current {
401
- return current
402
- }
403
-
404
- diff := curser - current
405
- if diff < 0 {
406
- diff *= - 1
407
- }
408
- return diff
409
- }
0 commit comments