diff --git a/scheme/nuit-packages.scm b/scheme/nuit-packages.scm index dedf927..4586dbd 100644 --- a/scheme/nuit-packages.scm +++ b/scheme/nuit-packages.scm @@ -121,7 +121,9 @@ move-cursor-up move-cursor-down paint-selection-list - paint-selection-list-at)) + paint-selection-list-at + select-list-get-selection + select-list-selected-entry)) (define-structure select-list select-list-interface (open scheme diff --git a/scheme/select-list.scm b/scheme/select-list.scm index 0bc9d03..984dd9f 100644 --- a/scheme/select-list.scm +++ b/scheme/select-list.scm @@ -172,3 +172,13 @@ (else (mvwaddstr win y x (element-text (car elts))) (lp (cdr elts) (+ y 1) (+ i 1)))))))) + +(define (select-list-get-selection select-list) + (map element-value + (filter-map element-marked? + (select-list-elements select-list)))) + +(define (select-list-selected-entry select-list) + (element-value + (list-ref (select-list-elements select-list) + (select-list-cursor-index select-list)))) \ No newline at end of file