fix `select-list-get-selection' and avoid copying the list in `elements'
This commit is contained in:
parent
4e5a41db3d
commit
9b72181b54
|
@ -31,9 +31,7 @@
|
|||
(num-lines ,(select-list-num-lines r)))))
|
||||
|
||||
(define (make-select-list elements num-lines)
|
||||
(if (and (proper-list? elements) (every element? elements))
|
||||
(really-make-select-list elements 0 0 num-lines)
|
||||
(error "wrong argument type" elements)))
|
||||
(really-make-select-list elements 0 0 num-lines))
|
||||
|
||||
(define key-m 109)
|
||||
|
||||
|
@ -102,17 +100,6 @@
|
|||
(else
|
||||
(values (index-move cursor-index) view-index)))))
|
||||
|
||||
(define (copy-element-list elements)
|
||||
(fold-right
|
||||
(lambda (el result)
|
||||
(cons
|
||||
(make-element (element-markable? el)
|
||||
(element-marked? el)
|
||||
(element-value el)
|
||||
(element-text el))
|
||||
result))
|
||||
'() elements))
|
||||
|
||||
(define (move-cursor-maker index-move)
|
||||
(lambda (select-list)
|
||||
(let* ((elements (select-list-elements select-list))
|
||||
|
@ -127,7 +114,7 @@
|
|||
num-lines))
|
||||
(lambda (cursor-index view-index)
|
||||
(really-make-select-list
|
||||
(copy-element-list elements)
|
||||
elements
|
||||
view-index
|
||||
cursor-index
|
||||
num-lines))))))
|
||||
|
@ -177,8 +164,8 @@
|
|||
|
||||
(define (select-list-get-selection select-list)
|
||||
(map element-value
|
||||
(filter-map element-marked?
|
||||
(select-list-elements select-list))))
|
||||
(filter element-marked?
|
||||
(select-list-elements select-list))))
|
||||
|
||||
(define (select-list-selected-entry select-list)
|
||||
(element-value
|
||||
|
|
Loading…
Reference in New Issue